Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- server {
- listen 80;
- # Allow nginx to serve assets from docker
- location ^~ /my-app/assets/ {
- rewrite /my-app(/assets/.*) $1;
- root /app/public/;
- gzip_static on;
- expires max;
- add_header Cache-Control public;
- add_header Strict-Transport-Security "";
- }
- # Allow nginx to serve assets from ALB
- location ^~ /assets/ {
- root /app/public/;
- gzip_static on;
- expires max;
- add_header Cache-Control public;
- add_header Strict-Transport-Security "";
- }
- location / {
- proxy_pass http://my-app:3000;
- add_header Strict-Transport-Security "";
- }
- }
- version: "3.4"
- services:
- my-app:
- build:
- context: .
- target: my-app
- restart: "no"
- env_file:
- ./.my-app.env
- links:
- - postgres
- command: >
- /bin/bash -c "
- while ! nc -z postgres 5432;
- do
- echo waiting for postgres;
- sleep 1;
- done;
- echo Connected!;
- bundle exec rake db:create db:migrate;
- rm -f /app/tmp/pids/server.pid
- bundle exec rake assets:clobber
- bundle exec rake assets:precompile RAILS_ENV=production
- bundle exec rake assets:precompile RAILS_ENV=staging
- bundle exec rails server;
- "
- postgres:
- image: postgres:9.6
- environment:
- POSTGRES_USER: postgres
- POSTGRES_PASSWORD: postgres
- ports:
- - '5432:5432'
- my-app-nginx:
- build:
- context: .
- target: nginx
- links:
- - skymap
- restart: "no"
- ports:
- - '3000:80'
- # Start NGINX container config
- FROM nginx as nginx
- WORKDIR /public
- COPY docker/nginx.conf /etc/nginx/conf.d/default.conf
- COPY public /public
Add Comment
Please, Sign In to add comment