diff --git a/Dockerfile b/Dockerfile index f015967..1946e20 100644 --- a/Dockerfile +++ b/Dockerfile @@ -87,11 +87,13 @@ ARG LEIN_ROOT=yes # install asciinema +ENV RAILS_ENV "production" + RUN mkdir -p /app/tmp /app/log WORKDIR /app ADD Gemfile* /app/ -RUN bundle install +RUN bundle install --deployment --without development test ADD a2png/project.clj /app/a2png/ RUN cd a2png && lein deps @@ -99,7 +101,7 @@ RUN cd a2png && lein deps ADD . /app RUN cd src && make - +RUN bundle exec rake assets:precompile RUN cd a2png && lein cljsbuild once main && lein cljsbuild once page # configure Nginx @@ -116,7 +118,6 @@ VOLUME ["/app/config", "/app/log", "/app/uploads"] # 172.17.42.1 is the docker0 address ENV DATABASE_URL "postgresql://postgres:mypass@172.17.42.1/asciinema" ENV REDIS_URL "redis://172.17.42.1:6379" -ENV RAILS_ENV "development" # when using Docker Toolbox/Virtualbox this is going to be your address # set to whatever FQDN/address you want asciinema to advertise itself as # for ex. asciinema.example.com diff --git a/docker/nginx/asciinema.conf b/docker/nginx/asciinema.conf index 981aa6e..6e92331 100644 --- a/docker/nginx/asciinema.conf +++ b/docker/nginx/asciinema.conf @@ -16,6 +16,14 @@ server { try_files $uri $uri/index.html $uri.html @rails; } + location ~ ^/assets/ { + expires 1y; + add_header Cache-Control public; + + add_header ETag ""; + break; + } + location @rails { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;