Created
February 26, 2018 15:01
-
-
Save rickyc/e5d1593a28a73ba5e9c8191f519e06eb to your computer and use it in GitHub Desktop.
Basic Docker Compose to spin up a Ruby on Rails server.
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.2' | |
services: | |
db: | |
image: postgres:9.6-alpine | |
ports: | |
- 5432:5432 | |
app: &app | |
build: . | |
webpacker: | |
<<: *app | |
command: bundle exec bin/webpack-dev-server | |
environment: | |
- WEBPACKER_DEV_SERVER_HOST=0.0.0.0 | |
volumes: | |
- ./config/database.docker.example.yml:/app/config/database.yml | |
- .:/app | |
ports: | |
- 8080:8080 | |
web: | |
<<: *app | |
command: puma -C config/puma.rb | |
working_dir: /tmp/docker | |
environment: | |
- RAILS_ENV=development | |
- WEBPACKER_DEV_SERVER_HOST=webpacker | |
volumes: | |
- ./config/database.docker.example.yml:/app/config/database.yml | |
- .:/app | |
ports: | |
- 3000:3000 | |
depends_on: | |
- db | |
- webpacker |
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.4.2 | |
RUN apt-get update -qq && apt-get install -y \ | |
build-essential \ | |
apt-transport-https \ | |
apt-utils \ | |
cmake \ | |
libpq-dev | |
# for nokogiri | |
RUN apt-get install -y libxml2-dev libxslt1-dev | |
# for a JS runtime | |
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash - \ | |
&& apt-get install -y nodejs | |
# yarn | |
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \ | |
&& echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list \ | |
&& apt-get update \ | |
&& apt-get install -y yarn | |
ENV APP_HOME /tmp/docker | |
ADD . $APP_HOME | |
WORKDIR $APP_HOME | |
COPY . . | |
RUN bundle install | |
RUN yarn install |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment