Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ====== Dockerfile
- # Base image:
- FROM ruby:2.4.2
- # Install dependencies
- RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs software-properties-common
- RUN apt-get update -qq && apt-get install -y imagemagick
- # Set an environment variable where the Rails app is installed to inside of Docker image:
- ENV RAILS_ROOT /thegame
- #ENV RAILS_ENV production
- RUN mkdir -p $RAILS_ROOT
- # Set working directory, where the commands will be ran:
- WORKDIR $RAILS_ROOT
- # Gems:
- COPY Gemfile Gemfile.lock ./
- RUN gem install bundler && bundle install --jobs 20 --retry 5
- RUN gem list activerecord
- ADD config/puma.rb config/puma.rb
- # Copy the main application.
- COPY . .
- EXPOSE 3000
- ====== docker-compose.prod.yml
- version: '2'
- services:
- postgres:
- image: postgres:9.4.5
- environment:
- POSTGRES_USER: thegame
- POSTGRES_PASSWORD: thegame
- ports:
- - '5435:5432'
- volumes:
- - thegame-postgres:/var/lib/postgresql/data
- app:
- build:
- context: .
- dockerfile: Dockerfile.prod
- command: ./entrypoint
- volumes:
- - .:/thegame
- ports:
- - "3010:3000"
- env_file:
- - .env.production
- volumes:
- thegame-postgres:
- ====== entrypoint
- #!/bin/bash
- set -e
- if [[ -a /tmp/puma.pid ]]; then
- rm /tmp/puma.pid
- fi
- if [[ \$RAILS_ENV == "production" ]]; then
- rake assets:precompile
- fi
- rails server -b 0.0.0.0 -P /tmp/puma.pid -p 3000
- exec "\$@"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement