Skip to content

Instantly share code, notes, and snippets.

@willsza
Last active December 15, 2019 17:12
Show Gist options
  • Save willsza/6c7bc33ad9c352ccd1557715b1a15f9b to your computer and use it in GitHub Desktop.
Save willsza/6c7bc33ad9c352ccd1557715b1a15f9b to your computer and use it in GitHub Desktop.
Docker compose para Rails com Webpacker, Sidekiq e Redis
version: "3.7"
services:
redis:
env_file: .env
image: 'redis:4.0-alpine'
command: redis-server
ports:
- '6379:6379'
volumes:
- 'redis:/var/lib/redis/data'
sidekiq:
env_file: .env
image: myimg
command: "bundle exec sidekiq -q reports -e production"
depends_on:
- redis
app:
env_file: .env
image: myimg
command: bash producao.sh
ports:
- "3000:80"
- "2222:2222"
depends_on:
- "redis"
tty: true
stdin_open: true
volumes:
redis:
networks:
default:
ipam:
driver: default
config:
- subnet: 172.21.0.0/16
FROM ruby:2.5.5
RUN apt-get update && \
apt-get install -yqq apt-transport-https ca-certificates build-essential libpq-dev --fix-missing --no-install-recommends
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \
curl -sL https://deb.nodesource.com/setup_11.x | bash -
RUN apt-get update && \
apt-get install -yqq nodejs yarn
RUN apt-get update && \
apt-get install -yqq openssh-client openssh-server
RUN echo "root:Docker!" | chpasswd
ENV app /app/myapp/current
WORKDIR $app
COPY Gemfile Gemfile.lock ./
RUN gem install bundler -v 2.0.2
RUN bundle install
COPY package.json yarn.lock ./
RUN set -ex; \
yarn install --frozen-lockfile --production; \
yarn cache clean;
COPY . .
COPY sshd_config /etc/ssh/
EXPOSE 80 2222
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment