From 5bc52598838cbdb7a80982b4a75f7056efc2c9b4 Mon Sep 17 00:00:00 2001 From: Roger Sikorski Date: Fri, 31 Oct 2025 10:41:52 +0100 Subject: [PATCH 1/6] first implemenation of buildkit --- .gitea/workflows/dev.yaml | 78 +++++++++++++++++++++++++++----------- .gitea/workflows/main.yaml | 64 +++++++++++++++---------------- README.md | 4 +- 3 files changed, 89 insertions(+), 57 deletions(-) diff --git a/.gitea/workflows/dev.yaml b/.gitea/workflows/dev.yaml index 0105955..7e536c2 100644 --- a/.gitea/workflows/dev.yaml +++ b/.gitea/workflows/dev.yaml @@ -1,35 +1,69 @@ -name: docker-monica-build development +# name: docker-monica-build development + +# on: +# push: +# branches-ignore: +# - main # Läuft auf allen Branches außer `main` + +# jobs: +# dockerfile_lint: +# runs-on: ubuntu-22.04 +# steps: +# - uses: actions/checkout@v4 +# - uses: hadolint/hadolint-action@v3.1.0 +# with: +# dockerfile: Dockerfile + +# build: +# needs: dockerfile_lint +# runs-on: ubuntu-22.04 +# steps: +# - uses: actions/checkout@v4 +# - name: Clean Branch Name +# id: clean_branch_name +# run: | +# CLEANED_BRANCH_NAME=$(echo "${GITHUB_REF_NAME}" | tr '[:upper:]' '[:lower:]' | tr '/_' '-') +# echo "CLEAN_BRANCH_NAME=${CLEANED_BRANCH_NAME}" >> $GITHUB_ENV +# - name: Kaniko build +# uses: aevea/action-kaniko@v0.12.0 +# with: +# image: rogersik/monica +# registry: gitea.sikorski.cloud +# tag: "${{ env.CLEAN_BRANCH_NAME }}" +# cache: true +# username: rogersik +# password: ${{ secrets.REGISTRY_PASSWORD }} + +name: ci on: push: - branches-ignore: - - main # Läuft auf allen Branches außer `main` jobs: - dockerfile_lint: - runs-on: ubuntu-22.04 + docker: + runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - uses: hadolint/hadolint-action@v3.1.0 + - name: Login to gitea.sikorski.cloud + uses: docker/login-action@v3 with: - dockerfile: Dockerfile + registry: gitea.sikorski.cloud + username: rogersik + password: ${{ secrets.REGISTRY_PASSWORD }} - build: - needs: dockerfile_lint - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v4 - - name: Clean Branch Name + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Create Branch Name as valid tag name id: clean_branch_name run: | CLEANED_BRANCH_NAME=$(echo "${GITHUB_REF_NAME}" | tr '[:upper:]' '[:lower:]' | tr '/_' '-') echo "CLEAN_BRANCH_NAME=${CLEANED_BRANCH_NAME}" >> $GITHUB_ENV - - name: Kaniko build - uses: aevea/action-kaniko@v0.12.0 + + - name: Build and push + uses: docker/build-push-action@v6 with: - image: rogersik/monica - registry: gitea.sikorski.cloud - tag: "${{ env.CLEAN_BRANCH_NAME }}" - cache: true - username: rogersik - password: ${{ secrets.REGISTRY_PASSWORD }} + push: true + tags: gitea.sikorski.cloud/rogersik/monica:"${{ env.CLEAN_BRANCH_NAME }}" diff --git a/.gitea/workflows/main.yaml b/.gitea/workflows/main.yaml index 2745297..78420fa 100644 --- a/.gitea/workflows/main.yaml +++ b/.gitea/workflows/main.yaml @@ -1,34 +1,34 @@ -name: docker-monica-build main -on: - push: - tags: - - '[0-9]+.*' +# name: docker-monica-build main +# on: +# push: +# tags: +# - '[0-9]+.*' -jobs: - dockerfile_lint: - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v4 - - uses: hadolint/hadolint-action@v3.1.0 - with: - dockerfile: Dockerfile +# jobs: +# dockerfile_lint: +# runs-on: ubuntu-22.04 +# steps: +# - uses: actions/checkout@v4 +# - uses: hadolint/hadolint-action@v3.1.0 +# with: +# dockerfile: Dockerfile - build: - needs: dockerfile_lint - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v4 - - name: Extract Git Tag - id: get_tag - run: echo "TAG=${GITHUB_REF_NAME}" >> $GITHUB_ENV - - name: Kaniko build - uses: aevea/action-kaniko@v0.12.0 - with: - image: rogersik/monica - registry: gitea.sikorski.cloud - tag: '${{ env.TAG }}' - cache: true - build_args: | - GIT_TAG=${{ env.TAG }} - username: rogersik - password: ${{ secrets.REGISTRY_PASSWORD }} +# build: +# needs: dockerfile_lint +# runs-on: ubuntu-22.04 +# steps: +# - uses: actions/checkout@v4 +# - name: Extract Git Tag +# id: get_tag +# run: echo "TAG=${GITHUB_REF_NAME}" >> $GITHUB_ENV +# - name: Kaniko build +# uses: aevea/action-kaniko@v0.12.0 +# with: +# image: rogersik/monica +# registry: gitea.sikorski.cloud +# tag: '${{ env.TAG }}' +# cache: true +# build_args: | +# GIT_TAG=${{ env.TAG }} +# username: rogersik +# password: ${{ secrets.REGISTRY_PASSWORD }} diff --git a/README.md b/README.md index ffc23a3..b320abf 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,6 @@ # monica docker image -Branch: main [![Build Status](https://drone.sikorski.cloud/api/badges/RogerSik/Docker-monica/status.svg?ref=refs/heads/main)](https://drone.sikorski.cloud/RogerSik/Docker-monica) - This images extends * PHP Upload Limit (50MB) -* supervisord for Cronjobs like E-Mail notifications \ No newline at end of file +* supervisord for Cronjobs like E-Mail notifications -- 2.49.1 From e0f6101b2e14718ff1b0a8af7e2768a14762ae1c Mon Sep 17 00:00:00 2001 From: Roger Sikorski Date: Fri, 31 Oct 2025 11:38:24 +0100 Subject: [PATCH 2/6] test --- .gitea/workflows/dev.yaml | 72 +++++++++++++++++++++++++++------------ 1 file changed, 51 insertions(+), 21 deletions(-) diff --git a/.gitea/workflows/dev.yaml b/.gitea/workflows/dev.yaml index 7e536c2..cc1af1a 100644 --- a/.gitea/workflows/dev.yaml +++ b/.gitea/workflows/dev.yaml @@ -40,30 +40,60 @@ on: push: jobs: - docker: + build: + name: Build Image runs-on: ubuntu-latest + container: + image: docker:dind + steps: - - name: Login to gitea.sikorski.cloud - uses: docker/login-action@v3 - with: - registry: gitea.sikorski.cloud - username: rogersik - password: ${{ secrets.REGISTRY_PASSWORD }} - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 + - name: Set up Docker Context for Buildx + id: buildx-context + shell: sh + run: | + docker context use builders || docker context create builders + apk add nodejs - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 + - name: Set up Docker Buildx + uses: https://github.com/docker/setup-buildx-action@v3 + with: + version: latest + endpoint: builders - - name: Create Branch Name as valid tag name - id: clean_branch_name - run: | - CLEANED_BRANCH_NAME=$(echo "${GITHUB_REF_NAME}" | tr '[:upper:]' '[:lower:]' | tr '/_' '-') - echo "CLEAN_BRANCH_NAME=${CLEANED_BRANCH_NAME}" >> $GITHUB_ENV + - name: Login to gitea.sikorski.cloud + uses: docker/login-action@v3 + with: + registry: gitea.sikorski.cloud + username: rogersik + password: ${{ secrets.REGISTRY_PASSWORD }} - - name: Build and push - uses: docker/build-push-action@v6 - with: - push: true - tags: gitea.sikorski.cloud/rogersik/monica:"${{ env.CLEAN_BRANCH_NAME }}" + - name: Docker Meta + id: meta + uses: https://github.com/docker/metadata-action@v5 + with: + images: ${{ secrets.REGISTRY_URL }} + flavor: | + latest=false + tags: | + type=sha,prefix=,format=short + type=ref,event=tag + + - name: Create Branch Name as valid tag name + id: clean_branch_name + run: | + CLEANED_BRANCH_NAME=$(echo "${GITHUB_REF_NAME}" | tr '[:upper:]' '[:lower:]' | tr '/_' '-') + echo "CLEAN_BRANCH_NAME=${CLEANED_BRANCH_NAME}" >> $GITHUB_ENV + + + - name: Build and Push Docker Image + uses: https://github.com/docker/build-push-action@v6 + env: + ACTIONS_RUNTIME_TOKEN: '' + with: + pull: true + # push: ${{ github.event_name != 'pull_request' }} + push: true + labels: ${{ steps.meta.outputs.labels }} + provenance: false + tags: gitea.sikorski.cloud/rogersik/monica:"${{ env.CLEAN_BRANCH_NAME }}" -- 2.49.1 From d97e2cc2ac9341fd8b26fa2421714033b40e7e35 Mon Sep 17 00:00:00 2001 From: Roger Sikorski Date: Fri, 31 Oct 2025 11:41:47 +0100 Subject: [PATCH 3/6] tags fix --- .gitea/workflows/dev.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.gitea/workflows/dev.yaml b/.gitea/workflows/dev.yaml index cc1af1a..01409ed 100644 --- a/.gitea/workflows/dev.yaml +++ b/.gitea/workflows/dev.yaml @@ -85,7 +85,6 @@ jobs: CLEANED_BRANCH_NAME=$(echo "${GITHUB_REF_NAME}" | tr '[:upper:]' '[:lower:]' | tr '/_' '-') echo "CLEAN_BRANCH_NAME=${CLEANED_BRANCH_NAME}" >> $GITHUB_ENV - - name: Build and Push Docker Image uses: https://github.com/docker/build-push-action@v6 env: @@ -96,4 +95,4 @@ jobs: push: true labels: ${{ steps.meta.outputs.labels }} provenance: false - tags: gitea.sikorski.cloud/rogersik/monica:"${{ env.CLEAN_BRANCH_NAME }}" + tags: gitea.sikorski.cloud/rogersik/monica:${{ env.CLEAN_BRANCH_NAME }} -- 2.49.1 From cc235bfb68d50ae2215a75350bc9cb4e15cb9f4b Mon Sep 17 00:00:00 2001 From: Roger Sikorski Date: Fri, 31 Oct 2025 11:43:59 +0100 Subject: [PATCH 4/6] push --- Dockerfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 021d5d5..73a18e6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,7 @@ # https://hub.docker.com/_/monica -FROM monica:$GIT_TAG +# Default to 'latest' if GIT_TAG is not provided +ARG GIT_TAG=latest +FROM monica:${GIT_TAG} RUN \ # Use the default production configuration -- 2.49.1 From 582891e9ec62088b83f5514052a9573bf4e61dce Mon Sep 17 00:00:00 2001 From: Roger Sikorski Date: Fri, 31 Oct 2025 11:50:52 +0100 Subject: [PATCH 5/6] build rework --- .gitea/workflows/build.yaml | 86 ++++++++++++++++++++++++++++++++ .gitea/workflows/dev.yaml | 98 ------------------------------------- .gitea/workflows/main.yaml | 34 ------------- 3 files changed, 86 insertions(+), 132 deletions(-) create mode 100644 .gitea/workflows/build.yaml delete mode 100644 .gitea/workflows/dev.yaml delete mode 100644 .gitea/workflows/main.yaml diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml new file mode 100644 index 0000000..6633569 --- /dev/null +++ b/.gitea/workflows/build.yaml @@ -0,0 +1,86 @@ +name: Docker Build Workflow + +on: + push: + tags: + - '*' # Trigger bei Git-Tags + branches: + - '**' # Trigger bei allen Branches + pull_request: + +jobs: + dockerfile_lint: + name: Lint Dockerfile + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + - uses: hadolint/hadolint-action@v3.1.0 + with: + dockerfile: Dockerfile + + build: + name: Build and Push Docker Image + runs-on: ubuntu-latest + container: + image: docker:dind + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set Docker Build Tag + id: set_tag + run: | + # Default Docker tag + DOCKER_TAG="latest" + + # If this is a Git tag, use it + if [[ "${GITHUB_REF}" == refs/tags/* ]]; then + DOCKER_TAG="${GITHUB_REF#refs/tags/}" + fi + + echo "GIT_TAG=$DOCKER_TAG" >> $GITHUB_ENV + + - name: Set up Docker Context for Buildx + id: buildx-context + shell: sh + run: | + docker context use builders || docker context create builders + apk add nodejs + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + with: + version: latest + endpoint: builders + + - name: Login to gitea.sikorski.cloud + uses: docker/login-action@v3 + with: + registry: gitea.sikorski.cloud + username: rogersik + password: ${{ secrets.REGISTRY_PASSWORD }} + + - name: Docker Meta + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ secrets.REGISTRY_URL }} + flavor: | + latest=false + tags: | + type=sha,prefix=,format=short + type=ref,event=tag + + - name: Build and Push Docker Image + uses: docker/build-push-action@v6 + env: + ACTIONS_RUNTIME_TOKEN: '' + with: + pull: true + push: true + labels: ${{ steps.meta.outputs.labels }} + provenance: false + tags: gitea.sikorski.cloud/rogersik/monica:${{ env.GIT_TAG }} + build-args: | + GIT_TAG=${{ env.GIT_TAG }} diff --git a/.gitea/workflows/dev.yaml b/.gitea/workflows/dev.yaml deleted file mode 100644 index 01409ed..0000000 --- a/.gitea/workflows/dev.yaml +++ /dev/null @@ -1,98 +0,0 @@ -# name: docker-monica-build development - -# on: -# push: -# branches-ignore: -# - main # Läuft auf allen Branches außer `main` - -# jobs: -# dockerfile_lint: -# runs-on: ubuntu-22.04 -# steps: -# - uses: actions/checkout@v4 -# - uses: hadolint/hadolint-action@v3.1.0 -# with: -# dockerfile: Dockerfile - -# build: -# needs: dockerfile_lint -# runs-on: ubuntu-22.04 -# steps: -# - uses: actions/checkout@v4 -# - name: Clean Branch Name -# id: clean_branch_name -# run: | -# CLEANED_BRANCH_NAME=$(echo "${GITHUB_REF_NAME}" | tr '[:upper:]' '[:lower:]' | tr '/_' '-') -# echo "CLEAN_BRANCH_NAME=${CLEANED_BRANCH_NAME}" >> $GITHUB_ENV -# - name: Kaniko build -# uses: aevea/action-kaniko@v0.12.0 -# with: -# image: rogersik/monica -# registry: gitea.sikorski.cloud -# tag: "${{ env.CLEAN_BRANCH_NAME }}" -# cache: true -# username: rogersik -# password: ${{ secrets.REGISTRY_PASSWORD }} - -name: ci - -on: - push: - -jobs: - build: - name: Build Image - runs-on: ubuntu-latest - container: - image: docker:dind - - steps: - - - name: Set up Docker Context for Buildx - id: buildx-context - shell: sh - run: | - docker context use builders || docker context create builders - apk add nodejs - - - name: Set up Docker Buildx - uses: https://github.com/docker/setup-buildx-action@v3 - with: - version: latest - endpoint: builders - - - name: Login to gitea.sikorski.cloud - uses: docker/login-action@v3 - with: - registry: gitea.sikorski.cloud - username: rogersik - password: ${{ secrets.REGISTRY_PASSWORD }} - - - name: Docker Meta - id: meta - uses: https://github.com/docker/metadata-action@v5 - with: - images: ${{ secrets.REGISTRY_URL }} - flavor: | - latest=false - tags: | - type=sha,prefix=,format=short - type=ref,event=tag - - - name: Create Branch Name as valid tag name - id: clean_branch_name - run: | - CLEANED_BRANCH_NAME=$(echo "${GITHUB_REF_NAME}" | tr '[:upper:]' '[:lower:]' | tr '/_' '-') - echo "CLEAN_BRANCH_NAME=${CLEANED_BRANCH_NAME}" >> $GITHUB_ENV - - - name: Build and Push Docker Image - uses: https://github.com/docker/build-push-action@v6 - env: - ACTIONS_RUNTIME_TOKEN: '' - with: - pull: true - # push: ${{ github.event_name != 'pull_request' }} - push: true - labels: ${{ steps.meta.outputs.labels }} - provenance: false - tags: gitea.sikorski.cloud/rogersik/monica:${{ env.CLEAN_BRANCH_NAME }} diff --git a/.gitea/workflows/main.yaml b/.gitea/workflows/main.yaml deleted file mode 100644 index 78420fa..0000000 --- a/.gitea/workflows/main.yaml +++ /dev/null @@ -1,34 +0,0 @@ -# name: docker-monica-build main -# on: -# push: -# tags: -# - '[0-9]+.*' - -# jobs: -# dockerfile_lint: -# runs-on: ubuntu-22.04 -# steps: -# - uses: actions/checkout@v4 -# - uses: hadolint/hadolint-action@v3.1.0 -# with: -# dockerfile: Dockerfile - -# build: -# needs: dockerfile_lint -# runs-on: ubuntu-22.04 -# steps: -# - uses: actions/checkout@v4 -# - name: Extract Git Tag -# id: get_tag -# run: echo "TAG=${GITHUB_REF_NAME}" >> $GITHUB_ENV -# - name: Kaniko build -# uses: aevea/action-kaniko@v0.12.0 -# with: -# image: rogersik/monica -# registry: gitea.sikorski.cloud -# tag: '${{ env.TAG }}' -# cache: true -# build_args: | -# GIT_TAG=${{ env.TAG }} -# username: rogersik -# password: ${{ secrets.REGISTRY_PASSWORD }} -- 2.49.1 From f47889579ad1c06d0951554cca87fd3cc5c2e4b1 Mon Sep 17 00:00:00 2001 From: Roger Sikorski Date: Fri, 31 Oct 2025 11:59:15 +0100 Subject: [PATCH 6/6] troubleshooting --- .gitea/workflows/build.yaml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml index 6633569..3acd429 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -2,11 +2,6 @@ name: Docker Build Workflow on: push: - tags: - - '*' # Trigger bei Git-Tags - branches: - - '**' # Trigger bei allen Branches - pull_request: jobs: dockerfile_lint: @@ -25,6 +20,12 @@ jobs: image: docker:dind steps: + - name: Set up nodejs + id: nodejs + shell: sh + run: | + apk add nodejs + - name: Checkout repository uses: actions/checkout@v4 -- 2.49.1