Skip to content

Instantly share code, notes, and snippets.

@5t111111
Last active June 28, 2016 08:38
Show Gist options
  • Save 5t111111/d8436b95ab68cea301e590d24857381e to your computer and use it in GitHub Desktop.
Save 5t111111/d8436b95ab68cea301e590d24857381e to your computer and use it in GitHub Desktop.

一度 build する。

$ docker-compose up --build

起動したら CTRL+C で停止。

マイグレーション。

$ docker-compose run rails bin/rails db:migrate

もう一度起動。

$ docker-compose up

docker ps で rails が EXPOSE しているポートを見て Web ブラウザでアクセスしてみる。

http://localhost:xxxxx

postgres:
image: postgres:9.5.3
environment:
POSTGRES_USER: kawaiichan
POSTGRES_PASSWORD: passwordxxx
volumes:
- kawaiichan-postgres:/var/lib/postgresql/data
redis:
image: redis:3.2.1
volumes:
- kawaiichan-redis:/var/lib/redis/data
rails:
build: .
links:
- postgres
- redis
volumes:
- .:/kawaiichan
ports:
- '3000'
env_file:
- secrets.env
FROM ruby:2.3.1
MAINTAINER Hirofumi Wakasugi <[email protected]>
RUN apt-get update && apt-get install -qq -y build-essential nodejs --fix-missing --no-install-recommends
ENV INSTALL_PATH /kawaiichan
RUN mkdir $INSTALL_PATH
WORKDIR $INSTALL_PATH
COPY Gemfile Gemfile
COPY Gemfile.lock Gemfile.lock
RUN bundle install --without developmet test --jobs 4
COPY . .
CMD bundle exec puma -C config/puma.rb
SECRET_TOKEN=xxxxxxxxxxxxxxxxxxxxxxxxxxxx
DATABASE_URL=postgresql://kawaiichan:passwordxxx@postgres:5432/kawaiichan?encoding=utf8&pool=5&timeout=5000
REDIS_URL=redis://redis.local:6379
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment