diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index a68713c..0a39098 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -40,7 +40,6 @@ jobs: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - - run: make docker-build - if: github.event_name == 'pull_request' - - run: make docker-build-push - if: github.event_name == 'push' + - uses: int128/buildx-push-action@v1 + with: + extra-args: --platform=linux/amd64,linux/arm64 diff --git a/Dockerfile b/Dockerfile index 0bada11..5632f1f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,8 +7,7 @@ COPY Makefile . COPY main.go . COPY cmd cmd COPY formatter formatter -ARG VERSION -RUN make VERSION=$VERSION +RUN make FROM gcr.io/distroless/base-debian10 COPY --from=builder /builder/slack-docker / diff --git a/Makefile b/Makefile index 47a219f..3550d1b 100644 --- a/Makefile +++ b/Makefile @@ -39,27 +39,3 @@ dist-release: dist .PHONY: clean clean: -rm $(TARGET) - -DOCKER_REPOSITORY := ghcr.io/int128/slack-docker -DOCKER_PLATFORM := linux/amd64,linux/arm64 - -.PHONY: docker-build -docker-build: Dockerfile - docker buildx build . \ - --build-arg=VERSION=$(VERSION) \ - --platform=$(DOCKER_PLATFORM) \ - --output=type=image,push=false \ - --cache-from=type=local,src=/tmp/buildx \ - --cache-to=type=local,mode=max,dest=/tmp/buildx - -.PHONY: docker-build-push -docker-build-push: Dockerfile - docker buildx build . \ - --push \ - --build-arg=VERSION=$(VERSION) \ - --platform=$(DOCKER_PLATFORM) \ - --tag=$(DOCKER_REPOSITORY):$(VERSION) \ - --cache-from=type=local,src=/tmp/buildx \ - --cache-to=type=local,mode=max,dest=/tmp/buildx.new - rm -fr /tmp/buildx - mv /tmp/buildx.new /tmp/buildx