From 590b46ae8d1d2f7d317d89f5945afd6c671c5979 Mon Sep 17 00:00:00 2001 From: Zohar Zilberman Date: Sun, 21 Sep 2025 12:56:52 +0300 Subject: [PATCH 1/2] Allow running release workflow on PRs --- .github/workflows/release.yml | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6b075da..a24491e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,6 +1,9 @@ name: ⎈ Release Version on: + pull_request: + branches: + - main push: tags: - v** @@ -60,7 +63,12 @@ jobs: - name: 🏷 Get tag id: tag run: | - echo "tag=${GITHUB_REF#refs/tags/}" >> "$GITHUB_OUTPUT" + if [ "${{ github.event_name }}" -eq "push" ] + then + echo "tag=${GITHUB_REF#refs/tags/}" >> "$GITHUB_OUTPUT" + else + echo "tag=ci-${{ github.run_number }}" >> "$GITHUB_OUTPUT" + fi - name: 🐳 Login to DockerHub uses: docker/login-action@v3 @@ -81,8 +89,8 @@ jobs: uses: docker/build-push-action@v6 with: context: . - build-args: BASE_IMAGE=platzio/base:v6 - push: true + build-args: BASE_IMAGE=platzio/base:v7 + push: ${{ github.event_name == 'push' }} platforms: linux/amd64,linux/arm64 tags: ${{ env.DOCKER_REPO }}:${{ steps.tag.outputs.tag }} cache-from: type=gha @@ -90,6 +98,7 @@ jobs: release: name: 🚀 Create Release + if: github.event_name == 'push' runs-on: ubuntu-latest needs: - image From 644c1f1a6681094c8b0f051ed7c9692e5710a4e4 Mon Sep 17 00:00:00 2001 From: Zohar Zilberman Date: Sun, 21 Sep 2025 12:58:21 +0300 Subject: [PATCH 2/2] Reapply "Replace Debian with Alpine" This reverts commit 945857dfe44a19aa46b05167f906aeb1f0365175. --- .github/workflows/release.yml | 2 +- Dockerfile | 12 ++++++--- docker-compose.yaml | 4 +-- scripts/container-build.sh | 49 +++-------------------------------- 4 files changed, 16 insertions(+), 51 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a24491e..db2cd8a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -20,7 +20,7 @@ jobs: runs-on: ubuntu-latest steps: - name: 🛎️ Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: 📦 Cargo version id: cargo diff --git a/Dockerfile b/Dockerfile index 5a4a5b2..27c423f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,15 +1,21 @@ ARG BASE_IMAGE -FROM --platform=$BUILDPLATFORM rust:1 AS build +FROM rust:1-trixie AS builder +RUN apt-get update && \ + apt-get install -y \ + musl \ + musl-dev \ + musl-tools + +FROM builder AS build ARG RELEASE_BUILD=1 -ARG TARGETARCH WORKDIR /build RUN mkdir -p /build/outputs COPY . /build RUN --mount=type=cache,id=platz-backend-cargo-target,target=/build/target,sharing=locked \ --mount=type=cache,id=platz-backend-cargo-git,target=/usr/local/cargo/git,sharing=locked \ --mount=type=cache,id=platz-backend-cargo-registry,target=/usr/local/cargo/registry,sharing=locked \ - ./scripts/container-build.sh "${TARGETARCH}" "${RELEASE_BUILD}" "/build/outputs" + ./scripts/container-build.sh "${RELEASE_BUILD}" "/build/outputs" FROM $BASE_IMAGE WORKDIR /root/ diff --git a/docker-compose.yaml b/docker-compose.yaml index c790a05..068c7d8 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,7 +1,7 @@ version: "3.9" services: db: - image: postgres:15 + image: postgres:17-alpine environment: POSTGRES_PASSWORD: postgres ports: @@ -16,7 +16,7 @@ services: build: context: . args: - BASE_IMAGE: platzio/base:v6 + BASE_IMAGE: platzio/base:v7 RELEASE_BUILD: 0 command: - /root/platz-api diff --git a/scripts/container-build.sh b/scripts/container-build.sh index 99699a1..1a0e6f7 100755 --- a/scripts/container-build.sh +++ b/scripts/container-build.sh @@ -1,51 +1,11 @@ #!/usr/bin/env bash -set -eu -set -o pipefail +set -euo pipefail -TARGETARCH="$1" -RELEASE_BUILD="$2" -BUILD_DEST="$3" - -case "$TARGETARCH" in \ - arm64) - LINUX_TARGETARCH="aarch64" - ;; - amd64) - LINUX_TARGETARCH="x86_64" - ;; - *) - echo "Unknown arch $TARGETARCH" - exit 1 - ;; -esac - -dpkg --add-architecture "${TARGETARCH}" - -if [ "${LINUX_TARGETARCH}" != `uname -m` ] -then - apt-get install -y "gcc-`echo ${LINUX_TARGETARCH} | tr '_' '-'`-linux-gnu" -fi - -cat >"${CARGO_HOME}/config.toml" <