Skip to content

Commit

Permalink
add a extra stage to build package inside docker/dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
jiang1997 committed Mar 20, 2023
1 parent e62e608 commit 0c73ead
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/publish-docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -48,6 +49,4 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push docker image
run: |
make env
make package
make push-image
13 changes: 10 additions & 3 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

0 comments on commit 0c73ead

Please sign in to comment.