feat(server): packaging Docker Compose et push Gitea Registry (ticket #52)
Ajoute le Dockerfile multi-stage (build dart:stable, runtime debian:bookworm-slim avec ca-certificates, exécutable AOT compilé), le docker-compose.yaml (API + Postgres avec healthcheck et depends_on: service_healthy), .env.example, .dockerignore et les scripts scripts/docker-entrypoint.sh (migration au démarrage) et scripts/push-gitea-image.sh (aucun identifiant en dur, mot de passe via --password-stdin). dart analyze clean, dart test 24/24 vert, `docker compose config` valide (syntaxe, interpolation de variables, healthcheck). Dockerfile et scripts relus manuellement et jugés corrects ; pas de docker build/compose up réel faute d'accès au daemon Docker dans ce sandbox. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@ -125,13 +125,73 @@ without failing the whole request. Accepting a share creates a new
|
||||
`409` for revoked or already answered shares, while missing shares or recipients
|
||||
return `404`.
|
||||
|
||||
## Docker Deployment
|
||||
|
||||
Ticket #52 adds Docker packaging for a headless Linux deployment. TLS is not
|
||||
handled by the API container: terminate HTTPS in an external reverse proxy and
|
||||
forward traffic to the Docker host on `API_PORT`.
|
||||
|
||||
Create a local environment file:
|
||||
|
||||
```bash
|
||||
cp .env.example .env
|
||||
```
|
||||
|
||||
Edit `.env` before deployment:
|
||||
|
||||
- `API_BIND_ADDRESS`: Docker host interface to publish. Use `0.0.0.0` for LAN
|
||||
access by the external reverse proxy, or a specific host IP to restrict the
|
||||
bind address.
|
||||
- `API_PORT`: host port exposed for the reverse proxy.
|
||||
- `POSTGRES_DB`, `POSTGRES_USER`, `POSTGRES_PASSWORD`: PostgreSQL bootstrap
|
||||
values.
|
||||
- `DATABASE_HOST`, `DATABASE_PORT`, `DATABASE_NAME`, `DATABASE_USER`,
|
||||
`DATABASE_PASSWORD`: database connection used by the API. With the provided
|
||||
Compose file, `DATABASE_HOST=postgres`.
|
||||
- `MIGRATE_ON_STARTUP`: when `true`, the API container applies SQL migrations
|
||||
before starting the server.
|
||||
|
||||
Start the stack from `server/`:
|
||||
|
||||
```bash
|
||||
docker compose up -d --build
|
||||
```
|
||||
|
||||
The `api` service waits for the PostgreSQL healthcheck, runs `/app/bin/migrate`,
|
||||
then launches `/app/bin/server`. Migrations are copied into the image under
|
||||
`/app/migrations`.
|
||||
|
||||
To inspect the fully interpolated Compose configuration:
|
||||
|
||||
```bash
|
||||
docker compose config
|
||||
```
|
||||
|
||||
## Gitea Registry
|
||||
|
||||
Build and push the server image to a Gitea Container Registry with no registry
|
||||
or credential value stored in the repository:
|
||||
|
||||
```bash
|
||||
GITEA_REGISTRY=gitea.example.com \
|
||||
GITEA_OWNER=my-org \
|
||||
GITEA_IMAGE_NAME=gametime-server \
|
||||
GITEA_IMAGE_TAG=latest \
|
||||
GITEA_USERNAME=my-user \
|
||||
GITEA_TOKEN='replace-with-token' \
|
||||
./scripts/push-gitea-image.sh
|
||||
```
|
||||
|
||||
`GITEA_IMAGE_TAG` defaults to `latest` when omitted. The script uses
|
||||
`docker login --password-stdin` so the token is not printed by the command line.
|
||||
|
||||
## Scope
|
||||
|
||||
Ticket #47 only scaffolds the Dart server, the hexagonal directory layout and
|
||||
the `/health` endpoint. Ticket #49 adds the first PostgreSQL schema. Ticket #48
|
||||
adds authentication. Ticket #50 adds sync. Ticket #51 adds targeted sharing.
|
||||
Ticket #52 adds Docker Compose packaging and Gitea registry publishing.
|
||||
|
||||
Upcoming tickets will fill the empty adapters and use cases:
|
||||
|
||||
- #52: Docker and registry packaging.
|
||||
- #53: API, contract and integration tests.
|
||||
|
||||
Reference in New Issue
Block a user