From 4c3a690d318a40cb011feff692f312bd4ef00721 Mon Sep 17 00:00:00 2001 From: Jeremi Piotrowski Date: Fri, 4 Mar 2022 12:18:32 +0100 Subject: [PATCH 1/2] Docker: update dockerfile/scripts for new image name --- Dockerfile | 7 ++++--- Dockerfile.build-alpine | 3 --- docker-build | 6 ++---- docker-push | 5 ++--- 4 files changed, 8 insertions(+), 13 deletions(-) delete mode 100644 Dockerfile.build-alpine diff --git a/Dockerfile b/Dockerfile index c76a17b..d769b1e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,8 +5,9 @@ COPY . . RUN apk update && apk add --virtual .build-deps bash git make \ && make \ && mv bin/ct /usr/bin/ \ - && mv Dockerfile.build-alpine /tmp \ && rm -rf $GOPATH \ && apk del .build-deps && rm -rf /var/cache/apk -WORKDIR /tmp -ENTRYPOINT ["/usr/bin/ct"] + +FROM scratch +COPY --from=0 /usr/bin/ct /ct +ENTRYPOINT ["/ct"] diff --git a/Dockerfile.build-alpine b/Dockerfile.build-alpine deleted file mode 100644 index 806a228..0000000 --- a/Dockerfile.build-alpine +++ /dev/null @@ -1,3 +0,0 @@ -FROM alpine:3.7 -COPY /usr/bin/ct /ct -ENTRYPOINT ["/ct"] diff --git a/docker-build b/docker-build index 80ab461..9bec563 100755 --- a/docker-build +++ b/docker-build @@ -2,7 +2,5 @@ set -e VERSION=$(git describe) -docker build -t $VERSION . -docker run --rm --entrypoint tar $VERSION -c /usr/bin/ct Dockerfile.build-alpine \ - | docker build -f Dockerfile.build-alpine --tag quay.io/coreos/ct:$VERSION - -docker tag quay.io/coreos/ct:$VERSION quay.io/coreos/ct:latest-dev +docker build --tag ghcr.io/flatcar-linux/ct:$VERSION . +docker tag ghcr.io/flatcar-linux/ct:$VERSION ghcr.io/flatcar-linux/ct:latest-dev diff --git a/docker-push b/docker-push index f195f97..b06c66b 100755 --- a/docker-push +++ b/docker-push @@ -2,6 +2,5 @@ set -e VERSION=$(git describe) -docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD" quay.io -docker push quay.io/coreos/ct:$VERSION -docker push quay.io/coreos/ct:latest-dev +docker push ghcr.io/flatcar-linux/ct:$VERSION +docker push ghcr.io/flatcar-linux/ct:latest-dev From ff2c55070a250be72a45c2b1d9ac4d19523e6ecf Mon Sep 17 00:00:00 2001 From: Jeremi Piotrowski Date: Fri, 4 Mar 2022 13:53:06 +0100 Subject: [PATCH 2/2] .github/workflows: add action to publish docker images --- .github/workflows/docker.yml | 49 ++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .github/workflows/docker.yml diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..c1b85bb --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,49 @@ +name: Build docker image +on: + push: + tags: + - v* +env: + REGISTRY: ghcr.io + IMAGE_NAME: flatcar-linux/ct + +jobs: + docker: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + + - name: Get tag name + id: meta + uses: docker/metadata-action@v3 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Setup QEMU + uses: docker/setup-qemu-action@v1 + with: + platforms: all + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Login to registry + uses: docker/login-action@v1 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v2 + with: + context: . + push: true + platforms: linux/amd64,linux/arm64/v8 + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }}