docker release
This commit is contained in:
92
README.md
Normal file
92
README.md
Normal file
@@ -0,0 +1,92 @@
|
||||
# docker-release
|
||||
|
||||
Builds every Fennec Hub project into a Docker image and pushes it to Docker Hub.
|
||||
|
||||
| Key | Image | Source |
|
||||
|------------|------------------------------------|---------------------------------------------------------------|
|
||||
| `backend` | `<namespace>/fennec-hub-backend` | `fennec-hub-multi-tenant-shared-db` (+ `fennec-hub-platfrom`) |
|
||||
| `admin` | `<namespace>/fennec-hub-admin-ui` | `fennec-hub-angular-ui` |
|
||||
| `commerce` | `<namespace>/fennec-hub-commerce` | `fennec-hub-commerce` |
|
||||
|
||||
`fennec-hub-platfrom` produces no image of its own — it is a Maven library that
|
||||
the backend Dockerfile installs from the repo-root build context before
|
||||
packaging the Spring Boot jar.
|
||||
|
||||
## Setup (once)
|
||||
|
||||
```bash
|
||||
cd docker-release
|
||||
cp .env.example .env
|
||||
$EDITOR .env # set DOCKERHUB_NAMESPACE, DOCKERHUB_USERNAME, DOCKERHUB_TOKEN
|
||||
```
|
||||
|
||||
Create the token at Docker Hub → *Account Settings → Personal access tokens*
|
||||
with **Read & Write** scope. `.env` is gitignored; leaving `DOCKERHUB_TOKEN`
|
||||
empty makes `docker login` prompt instead.
|
||||
|
||||
## Use
|
||||
|
||||
```bash
|
||||
./build-and-push.sh list # what would be built, and under which tag
|
||||
./build-and-push.sh all # login, build all three, push to Docker Hub
|
||||
./build-and-push.sh build # build locally, push nothing
|
||||
./build-and-push.sh all -s admin # one image only (-s is repeatable)
|
||||
./build-and-push.sh all -t 2026.09.05 # pin the tag instead of auto-generating
|
||||
./build-and-push.sh all --dry-run # print the docker commands, run nothing
|
||||
```
|
||||
|
||||
Every run also tags `:latest` unless you pass `--no-latest`.
|
||||
|
||||
### Tags
|
||||
|
||||
With no `-t` / `TAG=`, the tag is `<backend-git-sha>-<UTC timestamp>`, e.g.
|
||||
`a1b2c3d-20260905T2015Z`, falling back to just the timestamp when the backend
|
||||
directory is not a git checkout. That keeps every push traceable and immutable
|
||||
while `:latest` moves.
|
||||
|
||||
### Architectures
|
||||
|
||||
`PLATFORMS` defaults to `linux/amd64` (the Fennec servers). For a multi-arch
|
||||
image, pass `-p linux/amd64,linux/arm64` — the script then creates a
|
||||
`docker-container` buildx builder automatically. Multi-platform results cannot
|
||||
be loaded into the local image store, so they must be pushed: use `push`/`all`,
|
||||
not `build`. The Angular builds are slow under arm64 emulation.
|
||||
|
||||
## Deploying what you pushed
|
||||
|
||||
`docker-compose.yml` in this folder is the deployment counterpart of the
|
||||
repo-root one: same services and ports, but pulling the published images
|
||||
instead of building from source. It needs no source tree, so this file plus a
|
||||
`.env` can be copied to a server on its own.
|
||||
|
||||
```bash
|
||||
cd docker-release
|
||||
docker compose pull
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
Compose loads the same `.env` the build script uses, so `DOCKERHUB_NAMESPACE`
|
||||
and `TAG` carry over — set `TAG` to the tag you pushed (empty means `:latest`),
|
||||
or override per-run:
|
||||
|
||||
```bash
|
||||
TAG=a1b2c3d-20260905T2015Z docker compose up -d
|
||||
```
|
||||
|
||||
`SPRING_DATASOURCE_PASSWORD` is required and has no default — compose refuses
|
||||
to start without it. Set it in `.env` (gitignored) or in the environment. The
|
||||
datasource URL, username, CORS origins and Spring profile all have working
|
||||
defaults and are overridable the same way.
|
||||
|
||||
`docker-compose.hub.yml` is the identical file under its original name, kept
|
||||
for anyone already referencing it with `-f`. Edit both if you change one.
|
||||
|
||||
## Adding a project
|
||||
|
||||
Append a line to `images.conf`:
|
||||
|
||||
```
|
||||
key | image-name | build-context | path/to/Dockerfile | description
|
||||
```
|
||||
|
||||
Paths are relative to the repo root. Nothing in the script needs to change.
|
||||
Reference in New Issue
Block a user