From a1c92e0a580abcbd32839a0b5b76aec891eba965 Mon Sep 17 00:00:00 2001 From: Son Date: Wed, 15 May 2024 09:18:11 -0400 Subject: [PATCH] gh actions: remove hardcoded args on dockerfile and move to gh actions --- .github/workflows/develop.yml | 17 ++++++++++++++++- Dockerfile | 7 ++----- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/.github/workflows/develop.yml b/.github/workflows/develop.yml index 9576e86..acd23c8 100644 --- a/.github/workflows/develop.yml +++ b/.github/workflows/develop.yml @@ -7,11 +7,24 @@ on: # yamllint disable-line rule:truthy - 'README.md' - 'sample-config.conf' - 'sample-config.yaml' + - '.github/**' jobs: + check_versions: + name: Develop - Version checking + runs-on: ubuntu-latest + outputs: + version: ${{ steps.sogo.outputs.VERSION }} + steps: + - name: Get latest version of SOGo + id: sogo + run: | + echo "VERSION=$(curl -s https://api.github.com/repos/Alinto/sogo/releases/latest | jq -r '.tag_name' | sed 's/SOGo-//')" >> "$GITHUB_OUTPUT" + # Builds the Dockerfile and pushes it to dockerhub and GHCR develop: name: Develop - Docker image + needs: check_versions runs-on: ubuntu-latest steps: - name: Checkout @@ -41,4 +54,6 @@ jobs: with: platforms: linux/amd64 push: true - tags: ${{ steps.meta.outputs.tags }} \ No newline at end of file + tags: ${{ steps.meta.outputs.tags }} + build-args: | + SOGO_VERSION=${{ needs.check_versions.outputs.version }} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 267f476..7f607b2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,3 @@ -ARG ARCH=amd64 -ARG SOGO_VERSION=5.10.0 - FROM debian:bookworm AS builder ARG SOGO_VERSION @@ -54,7 +51,7 @@ RUN apt-get update -y && \ FROM debian:bookworm-slim -ARG ARCH +ARG TARGETARCH ENV PUID=1000 ENV PGID=1000 @@ -122,7 +119,7 @@ COPY supervisord.conf /opt/supervisord.conf COPY config_parser.sh /opt/config_parser.sh COPY entrypoint.sh /opt/entrypoint.sh -ADD https://github.com/mikefarah/yq/releases/latest/download/yq_linux_${ARCH} /usr/bin/yq +ADD https://github.com/mikefarah/yq/releases/latest/download/yq_linux_${TARGETARCH} /usr/bin/yq RUN rsync -avLkq /usr/local/lib/GNUstep/ /usr/lib/GNUstep && \ rsync -avLkq /usr/local/include/GNUstep/ /usr/include/GNUstep && \