Created
July 31, 2018 13:36
-
-
Save taross-f/ebf3b910f715339a91a72523da7e4743 to your computer and use it in GitHub Desktop.
rails tutorial dockerfile
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: '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" |
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 | |
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