Files
ci-image/.gitea/workflows/docker.yml
T
boxi ba0d41af85
Build and Push Docker Image / build (push) Successful in 8s
fixed the GiteaURL
2026-06-27 22:49:03 +02:00

44 lines
1.5 KiB
YAML

name: Build and Push Docker Image
on:
push:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Login to Registry
uses: docker/login-action@v2
with:
registry: gitea.tail276105.ts.net
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Docker imageTags
run: |
REPOSITORY_LC=$(echo "${{ gitea.repository }}" | tr '[:upper:]' '[:lower:]')
echo "versioned: gitea.tail276105.ts.net/${REPOSITORY_LC}:${GITHUB_RUN_NUMBER}"
echo "latest: gitea.tail276105.ts.net/${REPOSITORY_LC}:latest"
- name: Build Docker Image
run: |
REPOSITORY_LC=$(echo "${{ gitea.repository }}" | tr '[:upper:]' '[:lower:]')
# Build the image with the commit hash tag
docker build -t gitea.tail276105.ts.net/${REPOSITORY_LC}:${GITHUB_RUN_NUMBER} .
# Tag the same image as "latest"
docker tag gitea.tail276105.ts.net/${REPOSITORY_LC}:${GITHUB_RUN_NUMBER} gitea.tail276105.ts.net/${REPOSITORY_LC}:latest
- name: Push Docker Images
run: |
REPOSITORY_LC=$(echo "${{ gitea.repository }}" | tr '[:upper:]' '[:lower:]')
docker push gitea.tail276105.ts.net/${REPOSITORY_LC}:${GITHUB_RUN_NUMBER}
docker push gitea.tail276105.ts.net/${REPOSITORY_LC}:latest
- name: Log out from registry
if: always()
run: docker logout gitea.tail276105.ts.net