Publish frontend image to Gitea registry
Build and publish Docker image / build-and-publish (push) Failing after 5s
Build and publish Docker image / build-and-publish (push) Failing after 5s
This commit is contained in:
1 parent
364eb18bb1
commit
59d2a5aab3
2 files changed
+16
-11
No files matched your search
@@ -8,6 +8,7 @@ on:
|
|||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
|
packages: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-publish:
|
build-and-publish:
|
||||||
@@ -16,30 +17,34 @@ jobs:
|
|||||||
- name: Check out source
|
- name: Check out source
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Log in to Docker Hub
|
- name: Log in to Gitea Container Registry
|
||||||
env:
|
env:
|
||||||
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
|
REGISTRY_USERNAME: ${{ gitea.actor }}
|
||||||
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
|
REGISTRY_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
printf '%s' "$DOCKERHUB_TOKEN" |
|
printf '%s' "$REGISTRY_TOKEN" |
|
||||||
docker login --username "$DOCKERHUB_USERNAME" --password-stdin
|
docker login git.anchorhost.eu --username "$REGISTRY_USERNAME" --password-stdin
|
||||||
|
|
||||||
- name: Build and tag image
|
- name: Build and tag image
|
||||||
env:
|
env:
|
||||||
COMMIT_SHA: ${{ gitea.sha }}
|
COMMIT_SHA: ${{ gitea.sha }}
|
||||||
DOCKER_IMAGE: ${{ secrets.DOCKER_IMAGE }}
|
DOCKER_IMAGE: git.anchorhost.eu/anchorhost.eu/anchorhost-frontend
|
||||||
run: |
|
run: |
|
||||||
docker build \
|
docker build \
|
||||||
--label "org.opencontainers.image.revision=$COMMIT_SHA" \
|
--label "org.opencontainers.image.revision=$COMMIT_SHA" \
|
||||||
--tag "$DOCKER_IMAGE:frontend" \
|
--tag "$DOCKER_IMAGE:frontend" \
|
||||||
|
--tag "$DOCKER_IMAGE:main-${COMMIT_SHA:0:12}" \
|
||||||
.
|
.
|
||||||
|
|
||||||
- name: Push image
|
- name: Push image
|
||||||
env:
|
env:
|
||||||
DOCKER_IMAGE: ${{ secrets.DOCKER_IMAGE }}
|
COMMIT_SHA: ${{ gitea.sha }}
|
||||||
run: docker push "$DOCKER_IMAGE:frontend"
|
DOCKER_IMAGE: git.anchorhost.eu/anchorhost.eu/anchorhost-frontend
|
||||||
|
run: |
|
||||||
|
docker push "$DOCKER_IMAGE:frontend"
|
||||||
|
docker push "$DOCKER_IMAGE:main-${COMMIT_SHA:0:12}"
|
||||||
|
|
||||||
- name: Log out from Docker Hub
|
- name: Log out from Gitea Container Registry
|
||||||
if: always()
|
if: always()
|
||||||
run: docker logout
|
run: docker logout
|
||||||
|
|
||||||
@@ -17,6 +17,6 @@ Edit the root `branding.json` to set the product name, domain, logo path, public
|
|||||||
|
|
||||||
## Gitea Actions Docker publishing
|
## Gitea Actions Docker publishing
|
||||||
|
|
||||||
`.gitea/workflows/docker.yml` builds the Docker image when `main` is updated and can also be started manually from the Actions page. It publishes `git.anchorhost.eu/anchorhost.eu/anchorhost-frontend:main-latest` and a commit-specific `main-<12 character SHA>` tag to the Gitea Container Registry. The workflow uses Gitea's job token with only `contents: read` and `packages: write`; no registry password secret is needed.
|
`.gitea/workflows/docker.yml` builds the Docker image when `main` is updated and can also be started manually from the Actions page. It publishes `git.anchorhost.eu/anchorhost.eu/anchorhost-frontend:frontend` and a commit-specific `main-<12 character SHA>` tag to the Gitea Container Registry. The workflow logs in with Gitea's per-job `GITEA_TOKEN`, granted `contents: read` and `packages: write`; no registry password secret is needed.
|
||||||
|
|
||||||
Enable Actions and the Container Registry for the repository, and register an `ubuntu-latest` runner that has the Docker CLI and access to a working Docker daemon. The workflow cannot build until that runner is available. `.dockerignore` keeps local dependencies, Git history, build output, and recovered production artifacts out of the build context.
|
Enable Actions for the repository and ensure a runner with the Docker CLI and a working Docker daemon is registered. `.dockerignore` keeps local dependencies, Git history, build output, and recovered production artifacts out of the build context.
|
||||||
Reference in new issue
Block a user