Skip to content

Instantly share code, notes, and snippets.

@th0j
Created October 9, 2017 15:59
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 th0j/45a98ae2b8f32703f64916ac314a7de6 to your computer and use it in GitHub Desktop.
Save th0j/45a98ae2b8f32703f64916ac314a7de6 to your computer and use it in GitHub Desktop.
Speedup docker
version: '2'
services:
db:
image: postgres:9.6.5-alpine
volumes:
- postgres-data:/var/lib/postgresql/data
backend:
build: .
command: bash -c "rm -f tmp/pids/server.pid && bundle exec rails s -p 3000 -b '0.0.0.0'"
ports:
- "3000:3000"
depends_on:
- db
- redis
volumes:
- .:/app
- bundle:/bundle
environment:
- REDIS_URL=redis://redis:6379
redis:
image: redis:4.0.2-alpine
ports:
- "6379:6379"
volumes:
- redis-data:/var/lib/redis
command: redis-server
volumes:
postgres-data:
driver: local
redis-data:
driver: local
bundle:
driver: local
version: '2'
services:
db:
image: postgres:9.6.5-alpine
backend:
build: .
command: bash -c "rm -f tmp/pids/server.pid && bundle exec rails s -p 3000 -b '0.0.0.0'"
ports:
- "3000:3000"
depends_on:
- db
- redis
environment:
- REDIS_URL=redis://redis:6379
redis:
image: redis:4.0.2-alpine
ports:
- "6379:6379"
command: redis-server
FROM ruby:2.4.1-alpine3.6
RUN apk add --update build-base libffi-dev libxml2-dev libxslt-dev postgresql-dev nodejs tzdata bash
ENV RAILS_ENV=production \
APP_HOME=/app \
ENV BUNDLE_PATH /bundle
RUN mkdir -p $APP_HOME
WORKDIR $APP_HOME
RUN gem install bundler
COPY Gemfile* $APP_HOME/
COPY . $APP_HOME
EXPOSE 3000
CMD ["bundle", "exec", "rails", "server", "-b", "0.0.0.0"]
FROM ruby:2.4.1-alpine3.6
RUN apk add --update build-base libffi-dev libxml2-dev libxslt-dev postgresql-dev nodejs tzdata bash
ENV RAILS_ENV=production \
APP_HOME=/app \
RUN mkdir -p $APP_HOME
WORKDIR $APP_HOME
COPY Gemfile* $APP_HOME/
RUN gem install bundler
RUN bundle install
COPY . $APP_HOME
EXPOSE 3000
CMD ["bundle", "exec", "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