From 3388e809ba67c984cccb9387ee3d1eee43afdba5 Mon Sep 17 00:00:00 2001 From: James Brumond Date: Wed, 16 Aug 2023 17:03:16 -0700 Subject: [PATCH] separate workflow for build vs publish --- .gitea/workflows/build-and-publish.yaml | 45 +++++++++++++++++++++++++ .gitea/workflows/build.yaml | 20 ++++------- Dockerfile | 2 +- 3 files changed, 53 insertions(+), 14 deletions(-) create mode 100644 .gitea/workflows/build-and-publish.yaml diff --git a/.gitea/workflows/build-and-publish.yaml b/.gitea/workflows/build-and-publish.yaml new file mode 100644 index 0000000..f1ca354 --- /dev/null +++ b/.gitea/workflows/build-and-publish.yaml @@ -0,0 +1,45 @@ + +name: Build and publish container images + +on: [ workflow_dispatch ] + +jobs: + build-and-publish: + runs-on: ubuntu-latest + container: + image: catthehacker/ubuntu:act-latest + steps: + - name: Check out the repo + uses: actions/checkout@v3 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Log in to the Container registry + uses: docker/login-action@v2 + with: + registry: gitea.jbrumond.me + username: ${{ secrets.REGISTRY_USER }} + password: ${{ secrets.REGISTRY_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v4 + env: + # see + ACTIONS_RUNTIME_TOKEN: '' + with: + context: . + push: true + tags: | + gitea.jbrumond.me/images/rotate-backups:8 + gitea.jbrumond.me/images/rotate-backups:8.1 + platforms: | + linux/amd64 + linux/arm64 + build_args: | + PYTHON_VERSION=3 + ALPINE_VERSION=3.18 + ROTATE_BACKUPS_VERSION=8.1 diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml index 84b8ac2..892f4d4 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -1,5 +1,5 @@ -name: Build and publish container images +name: Build container images on: push: @@ -7,7 +7,7 @@ on: - master jobs: - build-and-publish: + build: runs-on: ubuntu-latest container: image: catthehacker/ubuntu:act-latest @@ -21,13 +21,6 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - - name: Log in to the Container registry - uses: docker/login-action@v2 - with: - registry: gitea.jbrumond.me - username: ${{ secrets.REGISTRY_USER }} - password: ${{ secrets.REGISTRY_TOKEN }} - - name: Build and push uses: docker/build-push-action@v4 env: @@ -35,10 +28,11 @@ jobs: ACTIONS_RUNTIME_TOKEN: '' with: context: . - push: true - tags: | - gitea.jbrumond.me/images/rotate-backups:8 - gitea.jbrumond.me/images/rotate-backups:8.1 + push: false platforms: | linux/amd64 linux/arm64 + build_args: | + PYTHON_VERSION=3 + ALPINE_VERSION=3.18 + ROTATE_BACKUPS_VERSION=8.1 diff --git a/Dockerfile b/Dockerfile index c5ba232..7e4ad37 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,7 +8,7 @@ FROM python:${PYTHON_VERSION}-alpine${ALPINE_VERSION} RUN apk update && apk add less RUN pip install rotate-backups==8.1 -# RUN pip install rotate-backups==$ROTATE_BACKUPS_VERSION +# RUN pip install rotate-backups==${ROTATE_BACKUPS_VERSION} RUN mkdir /data