Files
JottaCloud/.gitea/workflows/docker.yml
carsten 96cb85f513
Some checks failed
build-image / docker (push) Failing after 2s
Update .gitea/workflows/docker.yml
2025-10-30 20:40:35 +00:00

51 lines
1.6 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]
# Kør hele jobbet i en container med docker-cli
container:
image: alpine:3.20
options: -v /var/run/docker.sock:/var/run/docker.sock
steps:
- name: Install git + docker-cli
run: |
apk add --no-cache git docker-cli
- name: Checkout (public)
if: ${{ !secrets.CI_CLONE_TOKEN }}
run: |
git clone "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git" .
git rev-parse --short HEAD
- name: Checkout (private)
if: ${{ secrets.CI_CLONE_TOKEN }}
run: |
git clone "https://${{ secrets.CI_CLONE_TOKEN }}@${GITHUB_SERVER_URL#https://}/${GITHUB_REPOSITORY}.git" .
git rev-parse --short HEAD
- name: Build image (amd64)
run: |
docker version
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}"