Enhance Docker workflow: add Buildx setup and update README with Docker Compose instructions
All checks were successful
Publish Container / publish (push) Successful in 3m18s
All checks were successful
Publish Container / publish (push) Successful in 3m18s
This commit is contained in:
parent
95418270f7
commit
246a189bea
3 changed files with 78 additions and 20 deletions
37
README.md
37
README.md
|
|
@ -34,6 +34,30 @@ docker run --rm -p 8080:80 maddoscientisto-web:local
|
|||
|
||||
Open `http://localhost:8080`.
|
||||
|
||||
## Docker Compose deployment
|
||||
|
||||
A ready-to-use `docker-compose.yml` is included to build and run the site container. By default it maps container port `80` to host port `8002`.
|
||||
|
||||
Start the service (builds the image if needed) with:
|
||||
|
||||
```bash
|
||||
docker compose up --build -d
|
||||
```
|
||||
|
||||
Verify the site at:
|
||||
|
||||
```bash
|
||||
curl http://localhost:8002/
|
||||
```
|
||||
|
||||
To stop and remove the service:
|
||||
|
||||
```bash
|
||||
docker compose down
|
||||
```
|
||||
|
||||
You can customize the built image name and tag via environment variables read by Compose (`IMAGE_REGISTRY` and `IMAGE_TAG`), or edit `docker-compose.yml` to change the published host port.
|
||||
|
||||
## Forgejo registry configuration
|
||||
|
||||
Set these Forgejo Actions variables:
|
||||
|
|
@ -50,7 +74,7 @@ Set these Forgejo Actions secrets:
|
|||
|
||||
## Workflow behavior
|
||||
|
||||
The workflow in `.forgejo/workflows/publish-container.yml` runs on pushes to `master` (and manual dispatch), builds the container image, and pushes:
|
||||
The workflow in `.forgejo/workflows/publish-container.yml` runs on pushes to `master` (and manual dispatch), bootstraps Docker Buildx if needed, then builds and pushes the container image with BuildKit:
|
||||
|
||||
- `${FORGEJO_REGISTRY}/${IMAGE_NAMESPACE}/${IMAGE_NAME}:latest`
|
||||
- `${FORGEJO_REGISTRY}/${IMAGE_NAMESPACE}/${IMAGE_NAME}:sha-<12-char-commit>`
|
||||
|
|
@ -59,13 +83,6 @@ The workflow in `.forgejo/workflows/publish-container.yml` runs on pushes to `ma
|
|||
|
||||
If the runner image does not contain the `docker` binary, the workflow bootstraps a Docker CLI in user space before login/build/push.
|
||||
|
||||
For dind-based runners, the workflow resolves `DOCKER_HOST` in this order:
|
||||
If the runner image does not contain the Buildx plugin, the workflow also installs `docker-buildx` in the Docker CLI plugin directory before creating a builder.
|
||||
|
||||
- `vars.DOCKER_HOST` if explicitly set
|
||||
- `/var/run/docker.sock` if mounted into the job
|
||||
- `tcp://forgejo-docker-in-docker:2375` if that DNS name is visible inside the job container
|
||||
- `tcp://<job-container-default-gateway>:2375` as a fallback for nested Docker bridge setups
|
||||
|
||||
If you still get connection failures after the CLI bootstrap step, set a repo variable named `DOCKER_HOST` to the daemon endpoint that is reachable from inside the job container.
|
||||
|
||||
Important: the Compose service name `forgejo-docker-in-docker` is often only resolvable from the outer runner container, not from the inner job container created by the Docker daemon. In that case, use the gateway-based fallback or set `DOCKER_HOST` explicitly.
|
||||
For your current dind-based runner, the workflow defaults `DOCKER_HOST` to `tcp://172.17.0.1:2375` unless you set `vars.DOCKER_HOST` explicitly.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue