diff --git a/.github/workflows/publish-docker.yaml b/.github/workflows/publish-docker.yaml index f2aa2252..4fdd25fe 100644 --- a/.github/workflows/publish-docker.yaml +++ b/.github/workflows/publish-docker.yaml @@ -35,6 +35,7 @@ jobs: packages: write timeout-minutes: 30 env: + tag: ${{ github.sha }} VERSION: 1.0.0 steps: - uses: actions/checkout@v2 @@ -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/Makefile b/Makefile index 21cf31fa..bbf4ce1e 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/docker/Dockerfile b/docker/Dockerfile index f6688fec..e5918b48 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -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"]