mirror of
https://github.com/Open-Dev-Society/OpenStock.git
synced 2026-11-16 21:43:57 +08:00
NEXT_PUBLIC_OPENSTOCK_DATA_MODE is read by client components, so Next.js fixes it at build time. Since .env stopped being copied into the image (#94, #123), Docker builds could only ever be in cached mode. It is not a secret, so pass it as a build arg; compose takes it from .env. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
37 lines
1.1 KiB
YAML
37 lines
1.1 KiB
YAML
services:
|
|
openstock:
|
|
build:
|
|
context: .
|
|
args:
|
|
# Fixed into the app at build time; set it in .env, then rebuild
|
|
NEXT_PUBLIC_OPENSTOCK_DATA_MODE: ${NEXT_PUBLIC_OPENSTOCK_DATA_MODE:-cached}
|
|
ports:
|
|
- "3000:3000"
|
|
env_file:
|
|
- .env
|
|
restart: unless-stopped
|
|
depends_on:
|
|
mongodb:
|
|
condition: service_healthy
|
|
|
|
mongodb:
|
|
image: mongo:7
|
|
container_name: mongodb
|
|
restart: unless-stopped
|
|
environment:
|
|
MONGO_INITDB_ROOT_USERNAME: root
|
|
# Set MONGO_ROOT_PASSWORD in .env and use the same password in MONGODB_URI. Only read on the first start.
|
|
MONGO_INITDB_ROOT_PASSWORD: ${MONGO_ROOT_PASSWORD:-example}
|
|
# No published port: only the app reaches MongoDB, over the Compose network. To use mongosh or Compass from
|
|
# your machine, add ports: ["127.0.0.1:27017:27017"] (a bare "27017:27017" exposes it on every interface).
|
|
volumes:
|
|
- mongo-data:/data/db
|
|
healthcheck:
|
|
test: ["CMD", "mongosh", "--quiet", "--eval", "db.adminCommand('ping')"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
|
|
volumes:
|
|
mongo-data:
|