From 01dd5f78cc0ae9c5f2442a9bca9a6314765e4104 Mon Sep 17 00:00:00 2001 From: Tristiisch Date: Mon, 30 Sep 2024 20:04:40 +0200 Subject: [PATCH] f --- .github/workflows/python.yml | 13 +++++++++---- Dockerfile | 30 ++++++++++++++---------------- 2 files changed, 23 insertions(+), 20 deletions(-) diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 13e2356..ec3c540 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -168,7 +168,8 @@ jobs: - name: Prepare run: | platform=${{ matrix.platform }} - echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV + echo "platform_pair=${platform//\//-}" >> $GITHUB_OUTPUT + id: prepare - name: Checkout repository uses: actions/checkout@v4 @@ -207,7 +208,7 @@ jobs: PROJECT_VERSION=${{ needs.info.outputs.project_version }} outputs: | type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true - type=tar,dest=./pyramid.tar + type=docker - name: Export image digest run: | @@ -218,15 +219,19 @@ jobs: - name: Upload image digest as artifact uses: actions/upload-artifact@v4 with: - name: digests-${{ env.PLATFORM_PAIR }} + name: digests-${{ steps.prepare.outputs.platform_pair }} path: /tmp/digests/* if-no-files-found: error retention-days: 1 + - name: Export image + run: | + docker save pyramid:${{ steps.prepare.outputs.platform_pair }} -o "./pyramid.tar" + - name: Upload image as artifact uses: actions/upload-artifact@v4 with: - name: image-${{ env.PLATFORM_PAIR }} + name: image-${{ steps.prepare.outputs.platform_pair }} path: ./pyramid.tar if-no-files-found: error retention-days: 1 diff --git a/Dockerfile b/Dockerfile index bb76f8c..28a33b8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,29 +9,27 @@ FROM python:$PYTHON_VERSION-alpine AS builder WORKDIR /building -RUN \ - # Install virtual environment - python -m venv /opt/venv && \ - # Upgrade pip to the latest version - pip install --no-cache-dir --upgrade pip +# Install virtual environment +RUN python -m venv /opt/venv # Add the virtual environment to the PATH ENV PATH="/opt/venv/bin:$PATH" +# Install dependencies necessary for building Python packages +# Only for ARM64 architecture +RUN if [ "$(uname -m)" = "aarch64" ]; then \ + apk add --no-cache --virtual .build-deps gcc musl-dev libffi-dev; \ + fi + # Copy dependencies list COPY ./requirements.txt requirements.txt + +# Install Python dependencies +RUN pip install --no-cache-dir -r requirements.txt -RUN \ - # Install dependencies necessary for building Python packages - # Only for ARM64 architecture - if [ "$(uname -m)" = "aarch64" ]; then \ - apk add --no-cache --virtual .build-deps gcc musl-dev libffi-dev; \ - fi && \ - # Install Python dependencies - pip install --no-cache-dir -r requirements.txt && \ - # Clean up build dependencies for ARM64 architecture - if [ "$(uname -m)" = "aarch64" ]; then \ - apk del .build-deps; \ +# Clean up build dependencies for ARM64 architecture +RUN if [ "$(uname -m)" = "aarch64" ]; then \ + apk del .build-deps; \ fi # ============================ Base Image ============================