Merge pull request 'deploy: pull prebuilt registry images in compose (IMAGE_TAG)' (#54) from deploy/compose-use-registry-images into main
All checks were successful
Build container images / build (push) Successful in 56s
All checks were successful
Build container images / build (push) Successful in 56s
Reviewed-on: UOM/website#54 Reviewed-by: Colby Whitlock <whitlocktech@gmail.com>
This commit is contained in:
@@ -1,6 +1,13 @@
|
|||||||
# ─── UOMysticmoon — root environment (used by docker-compose) ───
|
# ─── UOMysticmoon — root environment (used by docker-compose) ───
|
||||||
# Copy to .env and fill in. NEVER commit the real .env.
|
# Copy to .env and fill in. NEVER commit the real .env.
|
||||||
|
|
||||||
|
# Container image tag pulled by docker-compose (app + bot). Published by the
|
||||||
|
# Gitea Actions workflow on every merge to main as `latest` and `sha-<7>`.
|
||||||
|
# Leave as `latest` for routine deploys; pin to a specific build for a
|
||||||
|
# reproducible deploy or rollback, e.g. IMAGE_TAG=sha-042a151.
|
||||||
|
# Deploy: `docker compose pull && docker compose up -d`.
|
||||||
|
IMAGE_TAG=latest
|
||||||
|
|
||||||
# App
|
# App
|
||||||
NODE_ENV=production
|
NODE_ENV=production
|
||||||
PORT=3000
|
PORT=3000
|
||||||
|
|||||||
14
README.md
14
README.md
@@ -111,6 +111,20 @@ docker compose up -d --build
|
|||||||
- Logs: `docker compose logs -f app` (and `./logs/app.log` on the host)
|
- Logs: `docker compose logs -f app` (and `./logs/app.log` on the host)
|
||||||
- Stop: `docker compose down` (add `-v` to also wipe the database + uploads volumes)
|
- Stop: `docker compose down` (add `-v` to also wipe the database + uploads volumes)
|
||||||
|
|
||||||
|
**Deploy prebuilt images (no local build).** Every merge to `main` publishes the
|
||||||
|
`app` and `bot` images to the Gitea container registry
|
||||||
|
(`.gitea/workflows/build-images.yml`), so on the server you can pull instead of
|
||||||
|
building:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker compose pull && docker compose up -d # IMAGE_TAG defaults to `latest`
|
||||||
|
# pin a specific build (reproducible deploy / rollback):
|
||||||
|
IMAGE_TAG=sha-042a151 docker compose pull && docker compose up -d
|
||||||
|
```
|
||||||
|
|
||||||
|
`build:` is kept in `docker-compose.yml`, so `docker compose up -d --build` still
|
||||||
|
works if you'd rather build locally.
|
||||||
|
|
||||||
### Option B — Local development (hot reload)
|
### Option B — Local development (hot reload)
|
||||||
|
|
||||||
Run the API and the Vite dev server separately. The Vite server proxies `/api` and `/uploads`
|
Run the API and the Vite dev server separately. The Vite server proxies `/api` and `/uploads`
|
||||||
|
|||||||
@@ -21,6 +21,13 @@ services:
|
|||||||
# - "3306:3306"
|
# - "3306:3306"
|
||||||
|
|
||||||
app:
|
app:
|
||||||
|
# Pull the prebuilt image from the Gitea registry (published by
|
||||||
|
# .gitea/workflows/build-images.yml on every merge to main). `build:` is kept
|
||||||
|
# so a local `docker compose build`/`up --build` still works; on the server,
|
||||||
|
# `docker compose pull && up -d` uses the registry image and never builds.
|
||||||
|
# IMAGE_TAG defaults to `latest`; pin a specific build for reproducible
|
||||||
|
# deploys / rollback, e.g. IMAGE_TAG=sha-042a151 (see .env / .env.example).
|
||||||
|
image: gitea.whitlocktech.com/uom/website-app:${IMAGE_TAG:-latest}
|
||||||
build: .
|
build: .
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
env_file: .env
|
env_file: .env
|
||||||
@@ -44,6 +51,8 @@ services:
|
|||||||
- "3000:3000"
|
- "3000:3000"
|
||||||
|
|
||||||
bot:
|
bot:
|
||||||
|
# Same as app: pull the prebuilt bot image; IMAGE_TAG pins the build.
|
||||||
|
image: gitea.whitlocktech.com/uom/website-bot:${IMAGE_TAG:-latest}
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: bot/Dockerfile
|
dockerfile: bot/Dockerfile
|
||||||
|
|||||||
Reference in New Issue
Block a user