Skip to content

Commit

Permalink
Pipeline fix: Docker push only on push, not PR
Browse files Browse the repository at this point in the history
  • Loading branch information
winromulus committed Dec 20, 2021
1 parent bb8c580 commit 77f97f4
Showing 1 changed file with 19 additions and 13 deletions.
32 changes: 19 additions & 13 deletions .github/workflows/pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,7 @@ jobs:
- name: tools - helm - install
uses: azure/setup-helm@v1

- name: tools - docker - login
uses: docker/login-action@v1
with:
username: ${{ secrets.ES_DOCKERHUB_USERNAME }}
password: ${{ secrets.ES_DOCKERHUB_PAT }}


- name: artifacts - prepare directories
run: mkdir -p .artifacts/helm
Expand All @@ -49,18 +45,28 @@ jobs:
name: helm
path: .artifacts/helm

- name: "docker - build and publish"
- name: "docker - build"
run: |
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
# docker buildx rm builder
docker buildx create --name builder --driver docker-container --use
docker buildx inspect --bootstrap
docker buildx build --push --platform linux/amd64 -t ${{env.imageRepository}}:build-${{env.version}}-amd64 -f src/docker/Dockerfile src/docker
docker buildx build --push --platform linux/arm -t ${{env.imageRepository}}:build-${{env.version}}-arm32v7 -f src/docker/Dockerfile src/docker
docker buildx build --push --platform linux/arm64 -t ${{env.imageRepository}}:build-${{env.version}}-arm64v8 -f src/docker/Dockerfile src/docker
docker pull ${{env.imageRepository}}:build-${{env.version}}-amd64
docker pull ${{env.imageRepository}}:build-${{env.version}}-arm32v7
docker pull ${{env.imageRepository}}:build-${{env.version}}-arm64v8
docker buildx build --platform linux/amd64 -t ${{env.imageRepository}}:build-${{env.version}}-amd64 -f src/docker/Dockerfile src/docker
docker buildx build --platform linux/arm -t ${{env.imageRepository}}:build-${{env.version}}-arm32v7 -f src/docker/Dockerfile src/docker
docker buildx build --platform linux/arm64 -t ${{env.imageRepository}}:build-${{env.version}}-arm64v8 -f src/docker/Dockerfile src/docker
- name: tools - docker - login
if: github.event_name == 'push'
uses: docker/login-action@v1
with:
username: ${{ secrets.ES_DOCKERHUB_USERNAME }}
password: ${{ secrets.ES_DOCKERHUB_PAT }}

- name: "docker - push"
if: github.event_name == 'push'
run: |
docker push ${{env.imageRepository}}:build-${{env.version}}-amd64
docker push ${{env.imageRepository}}:build-${{env.version}}-arm32v7
docker push ${{env.imageRepository}}:build-${{env.version}}-arm64v8
docker manifest create ${{env.imageRepository}}:build-${{env.version}} ${{env.imageRepository}}:build-${{env.version}}-amd64 ${{env.imageRepository}}:build-${{env.version}}-arm32v7 ${{env.imageRepository}}:build-${{env.version}}-arm64v8
docker manifest inspect ${{env.imageRepository}}:build-${{env.version}}
docker manifest push ${{env.imageRepository}}:build-${{env.version}}
Expand Down

0 comments on commit 77f97f4

Please sign in to comment.