Files
rabbitmq/.gitea/workflows/build-and-push.yaml
DeOwl fbb05d874e
Some checks failed
Build and Deploy Docker Image / build-and-push (push) Failing after 20s
v0.1.0
- working central server auth
- added ci/cd
2026-05-26 11:54:10 +03:00

55 lines
2.1 KiB
YAML

name: Build and Deploy Docker Image
# Controls when the workflow will run. Here, it runs on every push to the 'main' branch.
on:
push:
branches: ["main"]
# Environment variables used across the workflow
env:
# The URL of your Gitea instance (without http:// or https://)
GITEA_INSTANCE_URL: git.deowl.ru
# The full name of your image (e.g., 'myusername/myproject')
IMAGE_NAME: vkrb/rabbitmq-auth-backend
jobs:
build-and-push:
# Runs the job on a runner with the 'ubuntu-latest' label.
runs-on: ubuntu-latest
# Optional but recommended: specifies the container image to use for the job.
# This ensures a consistent environment with Docker tools pre-installed.
container:
image: catthehacker/ubuntu:act-latest
steps:
# 1. Check out your repository code so the workflow can access it.
- name: Checkout code
uses: actions/checkout@v4
# 2. Set up Docker Buildx, which is needed for building images.
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# 3. Log in to your Gitea instance's Container Registry.
# It uses secrets you must define in your repository settings.
- name: Log in to Gitea Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.GITEA_INSTANCE_URL }}
username: ${{ gitea.repository_owner }}
# Use a secret for the password/token. See Step 3 for setup.
password: ${{ secrets.REGISTRY_TOKEN }}
# 4. Build the Docker image from your 'dockerfile_build' directory
# and push it to the Gitea registry.
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
# The path to the directory containing your Dockerfile
context: ./dockerfile_build
push: true
# Tag the image with the Gitea instance, image name, and the git commit SHA.
tags: |
${{ env.GITEA_INSTANCE_URL }}/${{ env.IMAGE_NAME }}:latest
${{ env.GITEA_INSTANCE_URL }}/${{ env.IMAGE_NAME }}:${{ gitea.sha }}