Files
JottaCloud/.gitea/workflows/docker.yml
carsten a46dec662e
Some checks failed
build-image / docker (push) Failing after 17s
Update .gitea/workflows/docker.yml
2025-10-31 09:01:11 +00:00

55 lines
1.7 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
name: build-image
on:
push:
branches: [ main ]
workflow_dispatch:
jobs:
docker:
runs-on: [docker, linux, x86_64]
# Brug et image med docker-cli; runneren monterer automatisk docker.sock
container:
image: docker:27-cli
steps:
- name: Install git + CA certs
run: apk add --no-cache git ca-certificates
- name: Set BASE_URL
run: echo "BASE_URL=https://git.ckvist.dk" >> $GITHUB_ENV
# PUBLIC repo (ingen token)
- name: Checkout (public)
if: ${{ !secrets.CI_CLONE_TOKEN }}
run: |
git clone "${BASE_URL}/${GITHUB_REPOSITORY}.git" .
git rev-parse --short HEAD
# PRIVATE repo (brug PAT/token gemt som secret CI_CLONE_TOKEN)
- name: Checkout (private)
if: ${{ secrets.CI_CLONE_TOKEN }}
run: |
git clone "https://${{ secrets.CI_CLONE_TOKEN }}@${BASE_URL#https://}/${GITHUB_REPOSITORY}.git" .
git rev-parse --short HEAD
- name: Docker info
run: docker version
- name: Build image (amd64)
run: docker build -t jottacloud:latest .
# (Valgfrit) Push til registry kræver secrets
- name: Login & push
if: ${{ secrets.REGISTRY && secrets.REGISTRY_USER && secrets.REGISTRY_PASSWORD }}
run: |
REG="${{ secrets.REGISTRY }}"
IMG="${{ secrets.IMAGE_NAME || 'jottacloud' }}"
TAG_SHORT="$(git rev-parse --short HEAD)"
docker login "$REG" -u "${{ secrets.REGISTRY_USER }}" -p "${{ secrets.REGISTRY_PASSWORD }}"
docker tag jottacloud:latest "$REG/$IMG:latest"
docker tag jottacloud:latest "$REG/$IMG:${TAG_SHORT}"
docker push "$REG/$IMG:latest"
docker push "$REG/$IMG:${TAG_SHORT}"