Skip to content

Instantly share code, notes, and snippets.

@tanaka51
Last active September 9, 2017 04:45
Show Gist options
  • Save tanaka51/2a43f31aae36a94f975c58eee28a3ef7 to your computer and use it in GitHub Desktop.
Save tanaka51/2a43f31aae36a94f975c58eee28a3ef7 to your computer and use it in GitHub Desktop.

Revisions

  1. tanaka51 revised this gist Sep 9, 2017. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion docker-compose.yml
    Original file line number Diff line number Diff line change
    @@ -12,4 +12,5 @@ services:
    - .:/opt/app
    ports:
    - 3000:3000

    links:
    - mysql
  2. tanaka51 created this gist Sep 9, 2017.
    26 changes: 26 additions & 0 deletions Dockerfile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,26 @@
    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"]
    15 changes: 15 additions & 0 deletions docker-compose.yml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    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