Files
podcastdistributiona/docker-compose.yml
T
Leon SerfatyandClaude Opus 5 8067980774 fix(deploy): inject Dokploy env into containers via env_file
The compose services declared only STORAGE_DIR and PORT under `environment`,
so DATABASE_URL, BETTER_AUTH_SECRET and the Turnstile keys never reached the
containers: `docker compose` reads the generated .env for ${VAR} interpolation
(build args) but does not pass it into services on its own. `prisma migrate
deploy` therefore started with no DATABASE_URL and both containers exited 1 in
a restart loop.

Add `env_file: [.env]` to web and worker so the Environment tab actually
becomes runtime configuration, as the file's own comment already claimed.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-07 11:57:10 -04:00

68 lines
2.4 KiB
YAML

# Dokploy "Compose" application. Two services share one image + a storage volume.
# Set the env vars in Dokploy's Environment tab (they populate the .env Dokploy
# generates, which feeds both the build args and runtime env below).
services:
web:
build:
context: .
args:
NEXT_PUBLIC_APP_URL: ${NEXT_PUBLIC_APP_URL}
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY: ${NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY}
NEXT_PUBLIC_TURNSTILE_SITE_KEY: ${NEXT_PUBLIC_TURNSTILE_SITE_KEY}
NEXT_PUBLIC_GOOGLE_SITE_VERIFICATION: ${NEXT_PUBLIC_GOOGLE_SITE_VERIFICATION:-}
NEXT_PUBLIC_BING_SITE_VERIFICATION: ${NEXT_PUBLIC_BING_SITE_VERIFICATION:-}
UMAMI_HOST_URL: ${UMAMI_HOST_URL:-}
UMAMI_WEBSITE_ID: ${UMAMI_WEBSITE_ID:-}
image: podcast-distribution-ai:latest
# Apply pending migrations on boot, then serve.
command: sh -c "npx prisma migrate deploy && npm run start"
restart: unless-stopped
# Dokploy writes the Environment tab into a .env beside this file. Compose uses
# that for ${VAR} interpolation (the build args above) but does NOT put it
# inside the container — env_file is what actually injects DATABASE_URL,
# BETTER_AUTH_SECRET, the Turnstile keys, etc. at runtime.
env_file:
- .env
environment:
STORAGE_DIR: /app/storage
PORT: "3000"
# Also needed at run time, not just as build args: the app and admin route
# groups are `force-dynamic`, so the root layout re-reads these on every
# request rather than using the value baked into the prerendered HTML.
UMAMI_HOST_URL: ${UMAMI_HOST_URL:-}
UMAMI_WEBSITE_ID: ${UMAMI_WEBSITE_ID:-}
volumes:
- storage:/app/storage
# `default` keeps web<->worker talking; `dokploy-network` is where Dokploy's
# managed Postgres service lives, so Prisma can resolve the DB host.
networks:
- default
- dokploy-network
expose:
- "3000"
# Dokploy attaches the Traefik router (domain + SSL) to this service on port 3000.
worker:
image: podcast-distribution-ai:latest
command: npx tsx worker/index.ts
restart: unless-stopped
env_file:
- .env
environment:
STORAGE_DIR: /app/storage
volumes:
- storage:/app/storage
networks:
- default
- dokploy-network
depends_on:
- web
volumes:
storage:
# Created by Dokploy; every managed service (incl. Postgres) is attached to it.
networks:
dokploy-network:
external: true