Skip to content

Instantly share code, notes, and snippets.

@megaya

megaya/Dockerfile

Last active Dec 16, 2017
Embed
What would you like to do?
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