Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #### Dockerfile ####
- # Use the barebones version of Ruby 2.2.3.
- FROM ruby:2.2.3-slim
- # Optionally set a maintainer name to let people know who made this image.
- MAINTAINER Nick Janetakis <nick.janetakis@gmail.com>
- # Install dependencies:
- # - build-essential: To ensure certain gems can be compiled
- # - nodejs: Compile assets
- # - libpq-dev: Communicate with postgres through the postgres gem
- # - postgresql-client-9.4: In case you want to talk directly to postgres
- #RUN apt-get update && apt-get install -qq -y build-essential nodejs libpq-dev postgresql-client-9.4 --fix-missing --no-install-recommends
- # modifying ^ for OSX
- # you must have Xcode and Xcode command line tools installed
- # before running this
- CMD brew update && brew install node postgresql
- # Set an environment variable to store where the app is installed to inside
- # of the Docker image.
- ENV INSTALL_PATH /drkiq
- RUN mkdir -p $INSTALL_PATH
- # This sets the context of where commands will be ran in and is documented
- # on Docker's website extensively.
- WORKDIR $INSTALL_PATH
- # Ensure gems are cached and only get updated when they change. This will
- # drastically increase build times when your gems do not change.
- COPY Gemfile Gemfile
- RUN bundle install
- # Copy in the application code from your work station at the current directory
- # over to the working directory.
- COPY . .
- # Provide dummy data to Rails so it can pre-compile assets.
- RUN bundle exec rake RAILS_ENV=production DATABASE_URL=postgresql://user:pass@127.0.0.1/dbname SECRET_TOKEN=pickasecuretoken assets:precompile
- # Expose a volume so that nginx will be able to read in assets in production.
- VOLUME ["$INSTALL_PATH/public"]
- # The default command that gets ran will be to start the Unicorn server.
- CMD bundle exec unicorn -c config/unicorn.rb
- #### docker-compose.yml ####
- # taken directly from
- # https://semaphoreci.com/community/tutorials/dockerizing-a-ruby-on-rails-application
- postgres:
- image: postgres:9.4.5
- environment:
- POSTGRES_USER: drkiq
- POSTGRES_PASSWORD:
- ports:
- - '5432:5432'
- volumes:
- - drkiq-postgres:/var/lib/postgresql/data
- redis:
- image: redis:3.0.5
- ports:
- - '6379:6379'
- volumes:
- - drkiq-redis:/var/lib/redis/data
- drkiq:
- build: .
- links:
- - postgres
- - redis
- volumes:
- - .:/drkiq
- ports:
- - '8000:8000'
- env_file:
- - .drkiq.env
- sidekiq:
- build: .
- command: bundle exec sidekiq -C config/sidekiq.yml
- links:
- - postgres
- - redis
- volumes:
- - .:/drkiq
- env_file:
- - .drkiq.env
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement