-
-
Save openscript/004426ccf405ce2fb54d1a4c481e18c9 to your computer and use it in GitHub Desktop.
Rails Docker Configuration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DATABASE_USER=gugus | |
DATABASE_PASSWORD=gugus | |
RAILS_ENV=development | |
RACK_ENV=development | |
BUNDLE_PATH=/usr/local/bundle | |
USER_ID=1000 | |
GROUP_ID=990 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3' | |
services: | |
app: | |
build: . | |
command: bundle exec rails server -p 3000 -b '0.0.0.0' | |
environment: | |
- 'RAILS_ENV=${RAILS_ENV}' | |
- 'RACK_ENV=${RACK_ENV}' | |
- 'DATABASE_USER=${DATABASE_USER}' | |
- 'DATABASE_PASSWORD=${DATABASE_PASSWORD}' | |
- 'BUNDLE_PATH=${BUNDLE_PATH}' | |
hostname: sententia | |
volumes: | |
- .:/app | |
user: '${USER_ID}:${GROUP_ID}' | |
ports: | |
- '3000:3000' | |
depends_on: | |
- database | |
database: | |
hostname: database | |
image: postgres:10.4-alpine | |
environment: | |
- 'POSTGRES_USER=${DATABASE_USER}' | |
- 'POSTGRES_PASSWORD=${DATABASE_PASSWORD}' | |
user: '${USER_ID}:${GROUP_ID}' | |
volumes: | |
- ./tmp/db:/var/lib/postgresql/data:z |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ruby:2.5.1-alpine | |
RUN apk add --no-cache --update build-base \ | |
linux-headers \ | |
git \ | |
postgresql-dev \ | |
nodejs \ | |
yarn \ | |
tzdata | |
RUN mkdir -p /app | |
WORKDIR /app | |
COPY Gemfile /app/Gemfile | |
COPY Gemfile.lock /app/Gemfile.lock | |
RUN gem install bundler && bundle install --jobs 20 --retry 5 | |
COPY . /app |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment