Skip to content

Commit

Permalink
updates Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
saxix committed Jun 21, 2024
1 parent b34eb33 commit fd09613
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 6 deletions.
7 changes: 5 additions & 2 deletions .github/actions/docker_build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -178,11 +178,14 @@ 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 }}
- name: Status
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"
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
20 changes: 17 additions & 3 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -145,7 +147,13 @@ RUN set -x \
&& pdm sync --no-editable -v --no-self

RUN <<EOF cat> /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
Expand Down Expand Up @@ -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 <<EOF cat> /RELEASE
{"version": "$VERSION",
"commit": "$SOURCE_COMMIT",
"date": "$BUILD_DATE",
"distro": "dist",
"checksum": "$CHECKSUM",
"source": "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/tree/${SOURCE_COMMIT:-master}/"
}
Expand Down

0 comments on commit fd09613

Please sign in to comment.