Skip to content

Commit

Permalink
Use int128/buildx-push-action (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
int128 authored Mar 28, 2021
1 parent 6d00436 commit 01f5f83
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 30 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 /
Expand Down
24 changes: 0 additions & 24 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 01f5f83

Please sign in to comment.