Skip to content

Instantly share code, notes, and snippets.

@tanaka51
Last active September 9, 2017 04:45
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 tanaka51/2a43f31aae36a94f975c58eee28a3ef7 to your computer and use it in GitHub Desktop.
Save tanaka51/2a43f31aae36a94f975c58eee28a3ef7 to your computer and use it in GitHub Desktop.
a minimum rails environment with docker-compose
version: '3'
services:
mysql:
image: mysql:5.7.19
environment:
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
rails:
build: .
environment:
DATABASE_HOST: mysql
volumes:
- .:/opt/app
ports:
- 3000:3000
links:
- mysql
FROM ruby:2.4.1-alpine
ENV RAILS_ROOT /opt/app
RUN mkdir -p $RAILS_ROOT
WORKDIR $RAILS_ROOT
RUN set -x \
&& apk upgrade --no-cache \
&& apk add --no-cache --virtual build-dependencies \
less \
tzdata \
build-base \
mysql-dev \
nodejs \
&& apk add --no-cache \
libxml2-dev \
libxslt-dev \
&& gem install --no-document nokogiri \
-- --use-system-libraries \
--with-xml2-config=/usr/bin/xml2-config \
--with-xslt-config=/usr/bin/xslt-config \
&& gem install --no-document bundler rails
COPY . $RAILS_ROOT
RUN bundle install
CMD ["./bin/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