From 0c73ead1a6f797ec09290c43ca8ef32764a8a4fb Mon Sep 17 00:00:00 2001 From: jiang1997 Date: Mon, 20 Mar 2023 23:37:45 +0800 Subject: [PATCH] add a extra stage to build package inside docker/dockerfile --- .github/workflows/publish-docker.yaml | 7 +++---- docker/Dockerfile | 13 ++++++++++--- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/.github/workflows/publish-docker.yaml b/.github/workflows/publish-docker.yaml index f2aa2252..e2520953 100644 --- a/.github/workflows/publish-docker.yaml +++ b/.github/workflows/publish-docker.yaml @@ -23,12 +23,13 @@ on: - master env: - HUB: ghcr.io/apache/skywalking-python + tag: ${{ github.sha }} + HUB: ghcr.io/jiang1997/skywalking-python PROJECT: skywalking-python jobs: build-docker: - if: github.repository == 'apache/skywalking-python' + if: github.repository == 'jiang1997/skywalking-python' runs-on: ubuntu-latest permissions: contents: read @@ -48,6 +49,4 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} - name: Build and push docker image run: | - make env - make package make push-image diff --git a/docker/Dockerfile b/docker/Dockerfile index f6688fec..7a519ff2 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -16,14 +16,21 @@ ARG BASE_PYTHON_IMAGE -FROM ${BASE_PYTHON_IMAGE} +FROM ${BASE_PYTHON_IMAGE} as base + +FROM base as builder ARG SW_PYTHON_AGENT_PROTOCOL ARG SW_PYTHON_AGENT_VERSION -COPY dist/apache_skywalking*.whl /tmp/ +RUN pip install poetry +COPY ./ /tmp/ +RUN make -C /tmp/ package + +FROM base as final -RUN pip install --no-cache-dir /tmp/apache_skywalking*.whl +COPY --from=builder /tmp/dist/apache_skywalking*.whl /tmp/ +RUN pip install /tmp/apache_skywalking*.whl # So that the agent can be auto-started when container is started ENTRYPOINT ["sw-python"]