Skip to content

Commit

Permalink
Update docker-delivery workflow to create multi-arch images
Browse files Browse the repository at this point in the history
  • Loading branch information
jericop committed Aug 3, 2023
1 parent 02e0139 commit 42683ef
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 9 deletions.
21 changes: 12 additions & 9 deletions .github/workflows/delivery-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,18 @@ jobs:
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Pack Build/Publish
uses: dfreilich/pack-action@v2.1.1
env:
BP_GO_BUILD_LDFLAGS: "-s -w -X 'github.com/buildpacks/pack.Version=${{ steps.version.outputs.result }}'"
with:
args: 'build ${{ env.IMG_NAME }}:${{ steps.version.outputs.result }} --builder ${{ env.BUILDER }} --env BP_GO_BUILD_LDFLAGS --publish'
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2
- uses: buildpacks/github-actions/setup-tools@v5.3.0
- name: Buildx Build/Publish
run: |
docker buildx build . \
--tag ${{ env.IMG_NAME }}:${{ steps.version.outputs.result }} \
--platform linux/amd64,linux/arm64 \
--build-arg pack_version=${{ steps.version.outputs.result }} \
--provenance=false \
--push
- name: Tag Image as Latest
if: ${{ github.event.release != '' || github.event.inputs.tag_latest }}
run: |
docker pull ${{ env.IMG_NAME }}:${{ steps.version.outputs.result }}
docker tag ${{ env.IMG_NAME }}:${{ steps.version.outputs.result }} ${{ env.IMG_NAME }}:latest
docker push ${{ env.IMG_NAME }}:latest
crane copy ${{ env.IMG_NAME }}:${{ steps.version.outputs.result }} ${{ env.IMG_NAME }}:latest
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM golang:1.20-alpine as builder
ARG pack_version
ENV PACK_VERSION=$pack_version
WORKDIR /app
COPY . .
RUN apk update && apk upgrade && apk add --no-cache make ca-certificates
RUN update-ca-certificates
RUN make build

FROM scratch
COPY --from=builder /app/out/pack /usr/local/bin/pack
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
ENTRYPOINT [ "/usr/local/bin/pack" ]

0 comments on commit 42683ef

Please sign in to comment.