Refactor backend and add registry build workflow
Build and publish Docker image / build-and-publish (push) Successful in 2m45s
Build and publish Docker image / build-and-publish (push) Successful in 2m45s
This commit is contained in:
commit
c177d7981d
43 files changed
+18124
No files matched your search
@@ -0,0 +1,49 @@
|
||||
name: Build and publish Docker image
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
|
||||
jobs:
|
||||
build-and-publish:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out source
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Log in to Gitea Container Registry
|
||||
env:
|
||||
REGISTRY_USERNAME: ${{ gitea.actor }}
|
||||
REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
|
||||
run: |
|
||||
printf '%s' "$REGISTRY_TOKEN" |
|
||||
docker login git.anchorhost.eu --username "$REGISTRY_USERNAME" --password-stdin
|
||||
|
||||
- name: Build and tag image
|
||||
env:
|
||||
COMMIT_SHA: ${{ gitea.sha }}
|
||||
DOCKER_IMAGE: git.anchorhost.eu/anchorhost.eu/anchorhost-backend
|
||||
run: |
|
||||
docker build \
|
||||
--label "org.opencontainers.image.revision=$COMMIT_SHA" \
|
||||
--tag "$DOCKER_IMAGE:backend" \
|
||||
--tag "$DOCKER_IMAGE:main-${COMMIT_SHA:0:12}" \
|
||||
.
|
||||
|
||||
- name: Push image
|
||||
env:
|
||||
COMMIT_SHA: ${{ gitea.sha }}
|
||||
DOCKER_IMAGE: git.anchorhost.eu/anchorhost.eu/anchorhost-backend
|
||||
run: |
|
||||
docker push "$DOCKER_IMAGE:backend"
|
||||
docker push "$DOCKER_IMAGE:main-${COMMIT_SHA:0:12}"
|
||||
|
||||
- name: Log out from Gitea Container Registry
|
||||
if: always()
|
||||
run: docker logout
|
||||
Reference in new issue
Block a user