From 88f9e842eabc60d5a4f26b873555ac065df6e160 Mon Sep 17 00:00:00 2001 From: Ditmar Visser Date: Thu, 5 Jun 2025 14:39:07 +0000 Subject: [PATCH] feat: build docker image on push --- .gitea/workflows/build_docker.yaml | 59 ++++++++++++++++++++++++++++++ README.md | 1 + docker/Dockerfile | 3 ++ docker/app.py | 1 + 4 files changed, 64 insertions(+) create mode 100644 .gitea/workflows/build_docker.yaml create mode 100644 docker/Dockerfile create mode 100644 docker/app.py diff --git a/.gitea/workflows/build_docker.yaml b/.gitea/workflows/build_docker.yaml new file mode 100644 index 0000000..a1e870a --- /dev/null +++ b/.gitea/workflows/build_docker.yaml @@ -0,0 +1,59 @@ +name: Build Docker Image + +on: + push: + branches: + - main + paths: + - docker/** + workflow_dispatch: + +jobs: + release-image: + runs-on: skylab + container: + image: catthehacker/ubuntu:act-latest + env: + DOCKER_ORG: teacup + DOCKER_LATEST: nightly + RUNNER_TOOL_CACHE: /toolcache + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + - name: Set up Docker BuildX + uses: docker/setup-buildx-action@v2 + with: + config-inline: | + [registry."https://gitea.ditmarvisser.net"] + http = true + insecure = true + + - name: Login to DockerHub + uses: docker/login-action@v2 + with: + registry: https://gitea.ditmarvisser.net + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Get Meta + id: meta + run: | + echo REPO_NAME=$(echo ${GITHUB_REPOSITORY} | awk -F"/" '{print $2}') >> $GITHUB_OUTPUT + echo REPO_VERSION=$(git describe --tags --always | sed 's/^v//') >> $GITHUB_OUTPUT + + - name: Build and push + uses: docker/build-push-action@v4 + with: + context: . + file: ./Dockerfile + platforms: | + linux/amd64 + linux/arm64 + push: true + tags: | + https://gitea.ditmarvisser.net/${{ env.DOCKER_ORG }}/${{ steps.meta.outputs.REPO_NAME }}:${{ steps.meta.outputs.REPO_VERSION }} + https://gitea.ditmarvisser.net/${{ env.DOCKER_ORG }}/${{ steps.meta.outputs.REPO_NAME }}:${{ env.DOCKER_LATEST }} diff --git a/README.md b/README.md index c11e13f..a7cc410 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,3 @@ # les-06 +https://about.gitea.com/resources/tutorials/automating-release-versioning-with-gitea-actions-to-the-gitea-package-registry \ No newline at end of file diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..5edfd22 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,3 @@ +FROM alpine:3.22.0 + +CMD ["echo", "Hello, World!"] diff --git a/docker/app.py b/docker/app.py new file mode 100644 index 0000000..7df869a --- /dev/null +++ b/docker/app.py @@ -0,0 +1 @@ +print("Hello, World!")