initial commit
All checks were successful
Build & push Docker image / publish (push) Successful in 30s
All checks were successful
Build & push Docker image / publish (push) Successful in 30s
This commit is contained in:
42
.gitea/workflows/build-push.yml
Normal file
42
.gitea/workflows/build-push.yml
Normal file
@@ -0,0 +1,42 @@
|
||||
name: Build & push Docker image
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- '*' # Trigger on push to all branches
|
||||
|
||||
env:
|
||||
IMAGE_NAME: "contact-api" # e.g wavyzz/hello-world
|
||||
DOCKERFILE: "./Dockerfile"
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: https://github.com/actions/checkout@v5
|
||||
|
||||
- name: Extract branch name
|
||||
shell: bash
|
||||
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
|
||||
id: extract_branch
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: https://github.com/docker/setup-buildx-action@v3
|
||||
|
||||
- name: Login to private registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: https://${{ secrets.DOCKER_REGISTRY_HOST }}
|
||||
username: ${{ secrets.DOCKER_REGISTRY_USER }}
|
||||
password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: https://github.com/docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
file: "${{ env.DOCKERFILE }}"
|
||||
push: true
|
||||
tags: |
|
||||
${{ secrets.DOCKER_REGISTRY_HOST }}/${{ env.IMAGE_NAME }}:${{ steps.extract_branch.outputs.branch }}-latest
|
||||
${{ secrets.DOCKER_REGISTRY_HOST }}/${{ env.IMAGE_NAME }}:latest
|
||||
Reference in New Issue
Block a user