Skip to content

Commit

Permalink
fix: docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastocorp committed Aug 30, 2024
1 parent a1e45e6 commit 9078adb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
5 changes: 2 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the manager binary
FROM golang:1.22.3 as builder
FROM golang:1.22.3 AS builder
ARG TARGETOS
ARG TARGETARCH

Expand All @@ -24,10 +24,9 @@ RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -a -o co
# Use distroless as minimal base image to package the manager binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details
# FROM gcr.io/distroless/static:nonroot
FROM debian:buster-slim
FROM debian:bullseye-slim
WORKDIR /
COPY --from=builder /workspace/combi .
USER 65532:65532
RUN mkdir -p /root/.ssh && touch /root/.ssh/known_hosts

ENTRYPOINT ["/combi"]
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
BYNARY ?= combi
BINARY ?= combi
IMG_REG ?= freepik-company

# Image URL to use all building/pushing image targets
Expand Down Expand Up @@ -49,7 +49,8 @@ PLATFORMS ?= linux/arm64,linux/amd64,linux/s390x,linux/ppc64le
.PHONY: docker-buildx
docker-buildx: ## Build and push docker image for the manager for cross-platform support
# copy existing Dockerfile and insert --platform=${BUILDPLATFORM} into Dockerfile.cross, and preserve the original Dockerfile
sed -e '1 s/\(^FROM\)/FROM --platform=\$$\{BUILDPLATFORM\}/; t' -e ' 1,// s//FROM --platform=\$$\{BUILDPLATFORM\}/' Dockerfile > Dockerfile.cross
# sed -e '1 s/\(^FROM\)/FROM --platform=\$$\{BUILDPLATFORM\}/; t' -e ' 1,// s//FROM --platform=\$$\{BUILDPLATFORM\}/' Dockerfile > Dockerfile.cross
sed -e 's/\(^FROM\)/FROM --platform=\$$\{BUILDPLATFORM\}/g' Dockerfile > Dockerfile.cross
- $(CONTAINER_TOOL) buildx create --name project-builder
$(CONTAINER_TOOL) buildx use project-builder
- $(CONTAINER_TOOL) buildx build --push --platform=$(PLATFORMS) --tag ${IMG} -f Dockerfile.cross .
Expand Down

0 comments on commit 9078adb

Please sign in to comment.