Skip to content

Instantly share code, notes, and snippets.

@megaya
Last active December 16, 2017 02:57
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 megaya/1ed07c5b175e0c5980bfe3c054869fe2 to your computer and use it in GitHub Desktop.
Save megaya/1ed07c5b175e0c5980bfe3c054869fe2 to your computer and use it in GitHub Desktop.
RailsとDockerでdevops環境つくったときのメモ
FROM ruby:2.3.1-alpine
ENV BUILD_PACKAGES="curl-dev ruby-dev build-base bash git openssh nodejs" \
DEV_PACKAGES="zlib-dev libxml2-dev libxslt-dev tzdata yaml-dev postgresql-dev" \
RUBY_PACKAGES="ruby-json yaml nodejs"
RUN apk update && \
apk upgrade && \
apk add --update\
$BUILD_PACKAGES \
$DEV_PACKAGES \
$RUBY_PACKAGES && \
rm -rf /var/cache/apk/* && \
WORKDIR /usr/src/app
COPY . /usr/src/app
EXPOSE 3000
RUN bundle config build.nokogiri --use-system-libraries && \
gem install nokogiri -v 1.6.8 && \
gem install rails && \
bundle install && \
bundle clean
CMD ["rails", "s", "-b", "0.0.0.0", "-p", "3000"]
version: '2'
services:
data:
image: busybox
volumes:
- /var/lib/postgresql/data
postgres:
image: postgres:9.5.3
volumes_from:
- data
environment:
POSTGRES_PASSWORD: xxxxxxxx
elasticsearch:
image: elasticsearch:2.3.4
command: elasticsearch
web:
 image: image_name
volumes:
- .:/usr/src/app
links:
- postgres
- elasticsearch
command: ['rails', 's']
ports:
- "3000:3000"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment