Skip to content

Instantly share code, notes, and snippets.

@WagnerMatos
Created October 8, 2022 12:37
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 WagnerMatos/5ee9149e18bfa7f15be0068779d780ee to your computer and use it in GitHub Desktop.
Save WagnerMatos/5ee9149e18bfa7f15be0068779d780ee to your computer and use it in GitHub Desktop.
x-app: &default-app
build:
context: "."
target: "app"
args:
- "UID=${UID:-1000}"
- "GID=${GID:-1000}"
- "RAILS_ENV=${RAILS_ENV:-production}"
- "NODE_ENV=${NODE_ENV:-production}"
depends_on:
- "postgres"
- "redis"
# - "ngrok"
env_file:
- ".env"
restart: "${DOCKER_RESTART_POLICY:-unless-stopped}"
stop_grace_period: "3s"
tty: true
volumes:
- "${DOCKER_WEB_VOLUME:-./public:/app/public}"
x-assets: &default-assets
build:
context: "."
target: "assets"
args:
- "UID=${UID:-1000}"
- "GID=${GID:-1000}"
- "RAILS_ENV=${RAILS_ENV:-production}"
- "NODE_ENV=${NODE_ENV:-production}"
env_file:
- ".env"
profiles: ["assets"]
restart: "${DOCKER_RESTART_POLICY:-unless-stopped}"
stop_grace_period: "3s"
tty: true
volumes:
- ".:/app"
services:
postgres:
deploy:
resources:
limits:
cpus: "${DOCKER_POSTGRES_CPUS:-0}"
memory: "${DOCKER_POSTGRES_MEMORY:-0}"
environment:
POSTGRES_USER: "${POSTGRES_USER}"
POSTGRES_PASSWORD: "${POSTGRES_PASSWORD}"
# POSTGRES_DB: "${POSTGRES_DB}"
image: "postgres:14.5-bullseye"
profiles: ["postgres"]
restart: "${DOCKER_RESTART_POLICY:-unless-stopped}"
stop_grace_period: "3s"
volumes:
- "postgres:/var/lib/postgresql/data"
redis:
deploy:
resources:
limits:
cpus: "${DOCKER_REDIS_CPUS:-0}"
memory: "${DOCKER_REDIS_MEMORY:-0}"
image: "redis:7.0.5-bullseye"
profiles: ["redis"]
restart: "${DOCKER_RESTART_POLICY:-unless-stopped}"
stop_grace_period: "3s"
volumes:
- "redis:/data"
web:
<<: *default-app
deploy:
resources:
limits:
cpus: "${DOCKER_WEB_CPUS:-0}"
memory: "${DOCKER_WEB_MEMORY:-0}"
healthcheck:
test: "${DOCKER_WEB_HEALTHCHECK_TEST:-curl localhost:8000/up}"
interval: "60s"
timeout: "3s"
start_period: "5s"
retries: 3
ports:
- "${DOCKER_WEB_PORT_FORWARD:-127.0.0.1:8000}:${PORT:-8000}"
profiles: ["web"]
ngrok:
image: wernight/ngrok
ports:
- 4040:4040
depends_on:
- web
environment:
- NGROK_AUTHTOKEN=6E4rSAE3UGNPZ6PKX5Myp_5XKyLQM13qKAATr4QtJWc
- NGROK_PORT="host.docker.internal:8000"
command: "ngrok http -region=eu --authtoken 6E4rSAE3UGNPZ6PKX5Myp_5XKyLQM13qKAATr4QtJWc -subdomain=clever2 host.docker.internal:8000"
volumes:
- .:/app
worker:
<<: *default-app
command: "bundle exec sidekiq -C config/sidekiq.yml"
entrypoint: []
deploy:
resources:
limits:
cpus: "${DOCKER_WORKER_CPUS:-0}"
memory: "${DOCKER_WORKER_MEMORY:-0}"
profiles: ["worker"]
cable:
<<: *default-app
command: "puma -p 28080 cable/config.ru"
entrypoint: []
deploy:
resources:
limits:
cpus: "${DOCKER_CABLE_CPUS:-0}"
memory: "${DOCKER_CABLE_MEMORY:-0}"
ports:
- "${DOCKER_CABLE_PORT_FORWARD:-127.0.0.1:28080}:28080"
profiles: ["cable"]
js:
<<: *default-assets
command: "yarn build"
css:
<<: *default-assets
command: "yarn build:css"
volumes:
postgres: {}
redis: {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment