mirror of
https://github.com/int128/kubelogin.git
synced 2026-02-14 16:39:51 +00:00
Build image on pull request (#522)
This commit is contained in:
22
.github/workflows/docker.yaml
vendored
22
.github/workflows/docker.yaml
vendored
@@ -1,6 +1,15 @@
|
||||
name: docker
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
paths:
|
||||
- .github/workflows/docker.yaml
|
||||
- pkg/**
|
||||
- go.*
|
||||
- Dockerfile
|
||||
- Makefile
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
@@ -9,6 +18,7 @@ on:
|
||||
- pkg/**
|
||||
- go.*
|
||||
- Dockerfile
|
||||
- Makefile
|
||||
tags:
|
||||
- v*
|
||||
|
||||
@@ -19,9 +29,17 @@ jobs:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: docker/setup-qemu-action@v1
|
||||
- uses: docker/setup-buildx-action@v1
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: /tmp/buildx
|
||||
key: buildx-${{ runner.os }}-${{ github.sha }}
|
||||
restore-keys: |
|
||||
buildx-${{ runner.os }}-
|
||||
- uses: docker/login-action@v1
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.CR_PAT }}
|
||||
- run: make docker-build-push
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
- uses: int128/buildx-push-action@v1
|
||||
with:
|
||||
extra-args: --platform=linux/amd64,linux/arm64
|
||||
|
||||
@@ -6,8 +6,7 @@ RUN go mod download
|
||||
COPY Makefile .
|
||||
COPY main.go .
|
||||
COPY pkg pkg
|
||||
ARG VERSION
|
||||
RUN make VERSION=$VERSION
|
||||
RUN make
|
||||
|
||||
FROM gcr.io/distroless/base-debian10
|
||||
COPY --from=builder /builder/kubelogin /
|
||||
|
||||
12
Makefile
12
Makefile
@@ -36,18 +36,6 @@ endif
|
||||
dist-release: dist
|
||||
gh release upload $(VERSION) $(TARGET_ARCHIVE) $(TARGET_DIGEST) --clobber
|
||||
|
||||
DOCKER_REPOSITORY := ghcr.io/int128/kubelogin
|
||||
|
||||
.PHONY: docker-build-push
|
||||
docker-build-push: Dockerfile
|
||||
docker buildx build . \
|
||||
--build-arg=VERSION=$(VERSION) \
|
||||
--tag=$(DOCKER_REPOSITORY):$(VERSION) \
|
||||
--cache-from=type=registry,ref=$(DOCKER_REPOSITORY):latest \
|
||||
--cache-to=type=inline \
|
||||
--platform=linux/amd64,linux/arm64 \
|
||||
--push
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
-rm $(TARGET)
|
||||
|
||||
Reference in New Issue
Block a user