Skip to content

Instantly share code, notes, and snippets.

@taross-f
Created July 31, 2018 13:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save taross-f/ebf3b910f715339a91a72523da7e4743 to your computer and use it in GitHub Desktop.
Save taross-f/ebf3b910f715339a91a72523da7e4743 to your computer and use it in GitHub Desktop.
rails tutorial dockerfile
version: '2'
services:
app:
build: .
environment:
- "DATABASE_HOST=db"
- "DATABASE_PORT=5432"
- "DATABASE_USER=postgres"
- "DATABASE_PASSWORD=password"
ports:
- '3000:3000'
volumes:
- .:/app
links:
- db
db:
image: postgres:10.1
ports:
- "5432:5432"
environment:
- "POSTGRES_USER=postgres"
- "POSTGRES_PASSWORD=password"
FROM ruby:2.5.1
WORKDIR /app
COPY Gemfile* /app/
RUN apt-get update && \
apt-get install -y nodejs \
mysql-client \
postgresql-client \
sqlite3 \
--no-install-recommends
RUN bundle config --global frozen 1 \
&& bundle install -j4 --retry 3 \
&& rm -rf /usr/local/bundle/cache/*.gem \
&& find /usr/local/bundle/gems/ -name "*.c" -delete \
&& find /usr/local/bundle/gems/ -name "*.o" -delete
COPY . /app
EXPOSE 3000
CMD ["rails", "server", "-b", "0.0.0.0"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment