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 51de7f4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/publish-docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ jobs:
packages: write
timeout-minutes: 30
env:
tag: ${{ github.sha }}
VERSION: 1.0.0
steps:
- uses: actions/checkout@v2
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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ upload: package
poetry run twine upload dist/*

.PHONY: build-image
build-image: package
build-image:
$(MAKE) -C docker build AGENT_VERSION=$(VERSION)

.PHONY: push-image
Expand Down
15 changes: 7 additions & 8 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,13 @@

ARG BASE_PYTHON_IMAGE

FROM ${BASE_PYTHON_IMAGE}

ARG SW_PYTHON_AGENT_PROTOCOL
ARG SW_PYTHON_AGENT_VERSION

COPY dist/apache_skywalking*.whl /tmp/

RUN pip install --no-cache-dir /tmp/apache_skywalking*.whl
FROM ${BASE_PYTHON_IMAGE} as builder
RUN pip install poetry
COPY ./ /tmp/
RUN make -C /tmp/ package

FROM ${BASE_PYTHON_IMAGE} as final
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 51de7f4

Please sign in to comment.