From fd096136ef15066c2ee1183362daa70269982e73 Mon Sep 17 00:00:00 2001 From: saxix Date: Fri, 21 Jun 2024 07:48:23 +0200 Subject: [PATCH] updates Dockerfile --- .github/actions/docker_build/action.yml | 7 +++++-- .github/workflows/test.yml | 2 +- docker/Dockerfile | 20 +++++++++++++++++--- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/.github/actions/docker_build/action.yml b/.github/actions/docker_build/action.yml index ac97b6bc..d67c619c 100644 --- a/.github/actions/docker_build/action.yml +++ b/.github/actions/docker_build/action.yml @@ -164,8 +164,8 @@ runs: with: context: . tags: ${{ steps.meta.outputs.tags }} - labels: "${{ steps.meta.outputs.labels }}\na=1\nb=2" - annotations: "${{ steps.meta.outputs.annotations }}\nchecksum=${{ inputs.checksum }}" + labels: "${{ steps.meta.outputs.labels }}\nchecksum=${{ inputs.code_checksum }}\ndistro=${{ inputs.target }}" + annotations: "${{ steps.meta.outputs.annotations }}\nchecksum=${{ inputs.code_checksum }}\ndistro=${{ inputs.target }}" target: ${{ inputs.target }} file: ./docker/Dockerfile platforms: linux/amd64 @@ -178,6 +178,7 @@ runs: GITHUB_SERVER_URL=${{ github.server_url }} GITHUB_REPOSITORY=${{ github.repository }} BUILD_DATE=${{ env.BUILD_DATE }} + DISTRO=${{ inputs.target }} CHECKSUM=${{ inputs.code_checksum }} VERSION=${{ steps.meta.outputs.version }} SOURCE_COMMIT=${{ steps.last_commit.outputs.last_commit_short_sha }} @@ -185,4 +186,6 @@ runs: if: (steps.image_status.outputs.updated != 'true' || inputs.rebuild == 'true') && inputs.dryrun != 'true' shell: bash run: | + echo "${{ toJSON(steps.build_push.outputs) }}" + regctl image inspect -p linux/amd64 ${{ steps.image_name.outputs.name }} echo "::notice:: Image ${{ steps.meta.outputs.tags }} successfully built and pushed" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8f40ccf6..569ce984 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -211,7 +211,7 @@ jobs: - shell: bash run: | echo "${{ toJSON(steps.build.outputs) }}" -# - name: Generate artifact attestation +# - name: Generate artifact attestations # uses: actions/attest-build-provenance@v1 # with: # subject-name: ${{ steps.build.outputs.image }} diff --git a/docker/Dockerfile b/docker/Dockerfile index cfce73b8..c88d57dd 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -121,6 +121,8 @@ ARG VERSION ENV VERSION=$VERSION ARG BUILD_DATE ENV BUILD_DATE=$BUILD_DATE +ARG DISTRO +ENV DISTRO=$DISTRO ARG SOURCE_COMMIT ENV SOURCE_COMMIT=$SOURCE_COMMIT ARG GITHUB_SERVER_URL @@ -132,7 +134,7 @@ ENV GITHUB_REPOSITORY=$GITHUB_REPOSITORY LABEL date=$BUILD_DATE LABEL version=$VERSION LABEL checksum=$CHECKSUM -LABEL distro="builder-test" +LABEL distro="test" #COPY pyproject.toml pdm.lock ./ #COPY docker/conf/config.toml /etc/xdg/pdm/config.toml @@ -145,7 +147,13 @@ RUN set -x \ && pdm sync --no-editable -v --no-self RUN < /RELEASE -{"version": "$VERSION", "commit": "$SOURCE_COMMIT", "date": "$BUILD_DATE", "checksum": "$CHECKSUM", "source": "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/tree/${SOURCE_COMMIT:-master}/"} +{"version": "$VERSION", + "commit": "$SOURCE_COMMIT", + "date": "$BUILD_DATE", + "distro": "test", + "checksum": "$CHECKSUM", + "source": "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/tree/${SOURCE_COMMIT:-master}/" +} EOF FROM build_deps AS python_prod_deps @@ -199,11 +207,17 @@ ENV GITHUB_REPOSITORY=$GITHUB_REPOSITORY WORKDIR /code -COPY --chown=user:app --from=python_prod_deps /code /code +COPY --chown=user:app --from=python_prod_deps /code/__pypackages__ /code/__pypackages__ +ENV PATH=${APATH}:${PATH} \ + PYTHONPATH=${APYTHONPATH} \ + PYTHONDBUFFERED=1 + PYTHONDONTWRITEBYTCODE=1 + RUN < /RELEASE {"version": "$VERSION", "commit": "$SOURCE_COMMIT", "date": "$BUILD_DATE", + "distro": "dist", "checksum": "$CHECKSUM", "source": "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/tree/${SOURCE_COMMIT:-master}/" }