Skip to content

Commit

Permalink
dockerfile fixes and cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
jwtty committed Nov 2, 2023
1 parent 64d2145 commit 7544f23
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ jobs:
with:
push: ${{ github.event_name != 'pull_request' }}
files: |
docker-bake.hcl
docker/docker-bake.hcl
${{ steps.daemon.outputs.bake-file }}
${{ steps.controller.outputs.bake-file }}
${{ steps.cnimanager.outputs.bake-file }}
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,11 @@ run: manifests generate fmt vet ## Run a controller from your host.

.PHONY: docker-build
docker-build: unit-test docker-builder-setup ## Build docker image with the manager.
TAG=$(IMAGE_TAG) IMAGE_REGISTRY=$(IMAGE_REGISTRY) PLATFORMS=$(PLATFORMS) docker buildx bake -f docker-bake.hcl -f docker-localtag-bake.hcl --progress auto --push
TAG=$(IMAGE_TAG) IMAGE_REGISTRY=$(IMAGE_REGISTRY) PLATFORMS=$(PLATFORMS) docker buildx bake -f docker/docker-bake.hcl -f docker/docker-localtag-bake.hcl --progress auto --push

.PHONY: docker-build-multi-arch
docker-build-multi-arch: unit-test docker-builder-setup ## Build docker image with the manager.
TAG=$(IMAGE_TAG) IMAGE_REGISTRY=$(IMAGE_REGISTRY) PLATFORMS=$(PLATFORMS_MULTI_ARCH) docker buildx bake -f docker-bake.hcl -f docker-localtag-bake.hcl --progress auto --push
TAG=$(IMAGE_TAG) IMAGE_REGISTRY=$(IMAGE_REGISTRY) PLATFORMS=$(PLATFORMS_MULTI_ARCH) docker buildx bake -f docker/docker-bake.hcl -f docker/docker-localtag-bake.hcl --progress auto --push

.PHONY: docker-builder-setup
docker-builder-setup:
Expand Down
File renamed without changes.
File renamed without changes.
5 changes: 3 additions & 2 deletions cnimanager.Dockerfile → docker/cnimanager.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ WORKDIR /workspace
RUN wget -qO/bin/grpc_health_probe https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/${GRPC_HEALTH_PROBE_VERSION}/grpc_health_probe-linux-${TARGETARCH} && chmod +x /bin/grpc_health_probe

FROM gcr.io/distroless/static:latest
COPY --from=baseimg /${MAIN_ENTRY} .
ARG MAIN_ENTRY
COPY --from=baseimg /${MAIN_ENTRY} /
COPY --from=builder /bin/grpc_health_probe /usr/local/bin/grpc_health_probe
ENTRYPOINT [${MAIN_ENTRY}]
ENTRYPOINT [/${MAIN_ENTRY}]
10 changes: 5 additions & 5 deletions docker-bake.hcl → docker/docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ variable "PLATFORMS" {
}

target "base" {
dockerfile = "base.Dockerfile"
dockerfile = "docker/base.Dockerfile"
platforms = [PLATFORMS]
}

Expand All @@ -21,7 +21,7 @@ target "daemon-compile" {

target "daemon" {
inherits = ["daemon-tags"]
dockerfile = "gwdaemon.Dockerfile"
dockerfile = "docker/gwdaemon.Dockerfile"
contexts = {
baseimg = "target:daemon-compile"
}
Expand All @@ -48,7 +48,7 @@ target "cnimanager-compile" {

target "cnimanager" {
inherits = ["cnimanager-tags"]
dockerfile = "cnimanager.Dockerfile"
dockerfile = "docker/cnimanager.Dockerfile"
contexts = {
baseimg = "target:cnimanager-compile"
}
Expand All @@ -68,7 +68,7 @@ target "cni-compile" {

target "cni" {
inherits = ["cni-tags"]
dockerfile = "cni.Dockerfile"
dockerfile = "docker/cni.Dockerfile"
contexts = {
baseimg = "target:cni-compile"
}
Expand All @@ -84,7 +84,7 @@ target "cni-ipam-compile" {

target "cni-ipam" {
inherits = ["cni-ipam-tags"]
dockerfile = "cni.Dockerfile"
dockerfile = "docker/cni.Dockerfile"
contexts = {
baseimg = "target:cni-ipam-compile"
}
Expand Down
File renamed without changes.
6 changes: 6 additions & 0 deletions docker/gwdaemon.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# syntax=docker/dockerfile:1
FROM registry.k8s.io/build-image/distroless-iptables:v0.4.1
USER 0:0
ARG MAIN_ENTRY
COPY --from=baseimg /${MAIN_ENTRY} /${MAIN_ENTRY}
ENTRYPOINT [/${MAIN_ENTRY}]
5 changes: 0 additions & 5 deletions gwdaemon.Dockerfile

This file was deleted.

0 comments on commit 7544f23

Please sign in to comment.