Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
version: '2'
services:
rails: &rails
env_file: .env
depends_on:
- postgres
- redis
volumes:
- .:/app
volumes_from:
- datastore
build:
context: .
dockerfile: dockerfiles/Dockerfile-rails.dev
command: bundle exec rails s -p 3000 -b '0.0.0.0'
ports:
- '3000:3000'
node:
<<: *rails
build:
context: .
dockerfile: dockerfiles/Dockerfile-node.dev
command: /app/bin/webpack-dev-server --host 0.0.0.0
ports:
- '8080:8080'
datastore:
image: busybox
volumes:
- postgres_data:/var/lib/postgresql/data
- redis_data:/data
- app_tmp:/app/tmp
- app_vendor_bundle:/app/vendor/bundle
- app_node_modules:/app/vendor/node_modules
postgres:
image: postgres:alpine
volumes_from:
- datastore
redis:
image: redis:alpine
volumes_from:
- datastore
volumes:
postgres_data:
driver: local
redis_data:
driver: local
app_tmp:
driver: local
app_vendor_bundle:
driver: local
app_node_modules:
driver: local
FROM node:6.10-alpine
ENV LANG ja_JP.UTF-8
RUN apk update && \
apk upgrade && \
apk --update --upgrade add \
build-base \
ruby
RUN mkdir /app
WORKDIR /app
COPY vendor/yarn.lock vendor/package.json /app/vendor/
RUN npm install --global yarn && \
cd /app/vendor && \
yarn install
FROM ruby:2.3-alpine
ENV LANG ja_JP.UTF-8
RUN apk update && \
apk upgrade && \
apk --update --upgrade add \
build-base \
nodejs \
git \
postgresql-dev \
libxml2-dev \
libxslt-dev \
zlib-dev \
yaml-dev
RUN mkdir /app
WORKDIR /app
COPY Gemfile Gemfile.lock ./
RUN bundle config build.nokogiri --use-system-libraries && \
bundle install -j4 --path /app/vendor/bundle
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment