revert docker changes (#3429)

* Revert "github-actions: build docker platforms together (#3426)"

This reverts commit 507dbbdcf2.

* Revert "github-actions: faster docker publish (#3423)"

This reverts commit 6b386f2a00.
This commit is contained in:
Caleb Doxsey 2022-06-15 11:05:22 -06:00 committed by GitHub
parent 2a7b58938e
commit 6e1ebffc59
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,4 +1,4 @@
name: Docker name: Docker Main
permissions: permissions:
contents: read contents: read
on: on:
@ -8,31 +8,25 @@ on:
jobs: jobs:
publish: publish:
strategy: runs-on: ubuntu-latest
matrix:
platform: [ubuntu-latest]
dockerfile: [Dockerfile, Dockerfile.debug]
runs-on: ${{ matrix.platform }}
outputs: outputs:
sha-tag: ${{ steps.metadata.outputs.sha-tag }} sha-tag: ${{ steps.metadata.outputs.sha-tag }}
image: ${{ steps.metadata.outputs.image }} image: ${{ steps.metadata.outputs.image }}
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # pin@v3
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Set up QEMU - name: Set up QEMU
uses: docker/setup-qemu-action@8b122486cedac8393e77aa9734c3528886e4a1a8 uses: docker/setup-qemu-action@8b122486cedac8393e77aa9734c3528886e4a1a8 # pin@v1
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@dc7b9719a96d48369863986a06765841d7ea23f6 uses: docker/setup-buildx-action@dc7b9719a96d48369863986a06765841d7ea23f6 # pin@v1
- name: Login to DockerHub - name: Login to DockerHub
uses: docker/login-action@49ed152c8eca782a232dede0303416e8f356c37b uses: docker/login-action@49ed152c8eca782a232dede0303416e8f356c37b # pin@v1
with: with:
username: ${{ secrets.DOCKERHUB_USER }} username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }} password: ${{ secrets.DOCKERHUB_TOKEN }}
@ -42,52 +36,54 @@ jobs:
run: | run: |
IMAGE=pomerium/pomerium IMAGE=pomerium/pomerium
SHA_TAG=git-${GITHUB_SHA::8} SHA_TAG=git-${GITHUB_SHA::8}
if [ $DOCKERFILE == 'Dockerfile.debug' ]; then TAGS=${IMAGE}:main
TAGS=${IMAGE}:debug TAGS=${TAGS},${IMAGE}:master
else TAGS=${TAGS},${IMAGE}:${SHA_TAG}
TAGS=${IMAGE}:main
TAGS=${TAGS},${IMAGE}:master
TAGS=${TAGS},${IMAGE}:${SHA_TAG}
fi
TS=$(date +%Y%m%d%H%M%S) TS=$(date +%Y%m%d%H%M%S)
BUILDCACHE_TAG=buildcache-$(echo -n "$DOCKERFILE" | sha1sum | awk '{print $1}')
echo ::set-output name=tags::${TAGS} echo ::set-output name=tags::${TAGS}
echo ::set-output name=timestamp::${TS} echo ::set-output name=timestamp::${TS}
echo ::set-output name=name::pomerium echo ::set-output name=name::pomerium
echo ::set-output name=image::${IMAGE} echo ::set-output name=image::${IMAGE}
echo ::set-output name=sha-tag::${SHA_TAG} echo ::set-output name=sha-tag::${SHA_TAG}
echo ::set-output name=buildcache-tag::${BUILDCACHE_TAG}
env:
DOCKERFILE: ${{ matrix.dockerfile }}
- name: Docker Publish - name: Docker Publish - Main
uses: docker/build-push-action@e551b19e49efd4e98792db7592c17c09b89db8d8 uses: docker/build-push-action@e551b19e49efd4e98792db7592c17c09b89db8d8 # pin@v2
with: with:
context: . context: .
file: ${{ matrix.dockerfile }} file: ./Dockerfile
push: ${{ github.ref == 'refs/heads/main' }} push: true
platforms: linux/amd64,linux/arm64 platforms: linux/amd64,linux/arm64
tags: ${{ steps.metadata.outputs.tags }} tags: ${{ steps.metadata.outputs.tags }}
labels: | labels: |
org.opencontainers.image.created=${{ steps.metadata.outputs.timestamp }} org.opencontainers.image.created=${{ steps.metadata.outputs.timestamp }}
org.opencontainers.image.name=${{ steps.metadata.outputs.name }} org.opencontainers.image.name=${{ steps.metadata.outputs.name }}
org.opencontainers.image.revision=${{ github.sha }} org.opencontainers.image.revision=${{ github.sha }}
cache-from: type=registry,ref=pomerium/pomerium:${{ steps.metadata.outputs.buildcache-tag }}
cache-to: type=registry,ref=pomerium/pomerium:${{ steps.metadata.outputs.buildcache-tag }},mode=max,compression=zstd - name: Docker Publish - Debug
uses: docker/build-push-action@e551b19e49efd4e98792db7592c17c09b89db8d8 # pin@v2
with:
context: .
file: ./Dockerfile.debug
push: true
platforms: linux/amd64,linux/arm64
tags: pomerium/pomerium:debug
labels: |
org.opencontainers.image.created=${{ steps.metadata.outputs.timestamp }}
org.opencontainers.image.name=${{ steps.metadata.outputs.name }}
org.opencontainers.image.revision=${{ github.sha }}
deploy: deploy:
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: publish needs: publish
if: github.ref == 'refs/heads/main'
steps: steps:
- name: Checkout Gitops Repo - name: Checkout Gitops Repo
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # pin@v3
with: with:
repository: pomerium/gitops-argocd repository: pomerium/gitops-argocd
token: ${{ secrets.APPARITOR_GITHUB_TOKEN }} token: ${{ secrets.APPARITOR_GITHUB_TOKEN }}
- name: Bump psql environment - name: Bump psql environment
uses: mikefarah/yq@70403375d7b96075bd68b40c434807cff1593568 uses: mikefarah/yq@70403375d7b96075bd68b40c434807cff1593568 # pin@v4.23.1
with: with:
cmd: cmd:
yq eval '.pomerium.image.tag = "${{ needs.publish.outputs.sha-tag }}"' -i yq eval '.pomerium.image.tag = "${{ needs.publish.outputs.sha-tag }}"' -i