Removed comments from Dockerfile
This commit is contained in:
@@ -1,24 +1,19 @@
|
|||||||
# Wir sagen Docker: Der Builder soll IMMER auf der Architektur deines PCs laufen (schnell!)
|
|
||||||
FROM --platform=$BUILDPLATFORM golang:1.26-alpine AS builder
|
FROM --platform=$BUILDPLATFORM golang:1.26-alpine AS builder
|
||||||
|
|
||||||
RUN apk add --no-cache git
|
RUN apk add --no-cache git
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Cache für Module nutzen
|
|
||||||
COPY go.mod go.sum ./
|
COPY go.mod go.sum ./
|
||||||
RUN go mod download
|
RUN go mod download
|
||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
# buildx übergibt diese Variablen automatisch
|
|
||||||
ARG TARGETOS
|
ARG TARGETOS
|
||||||
ARG TARGETARCH
|
ARG TARGETARCH
|
||||||
|
|
||||||
# Hier passiert die Magie: Go kompiliert NATIV für das Ziel (Cross-Compilation)
|
|
||||||
RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH \
|
RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH \
|
||||||
go build -ldflags "-s -w" -o shap-planner-backend .
|
go build -ldflags "-s -w" -o shap-planner-backend .
|
||||||
|
|
||||||
# Final Stage (bleibt gleich klein)
|
|
||||||
FROM scratch
|
FROM scratch
|
||||||
COPY --from=builder /app/shap-planner-backend /shap-planner-backend
|
COPY --from=builder /app/shap-planner-backend /shap-planner-backend
|
||||||
ENTRYPOINT ["/shap-planner-backend"]
|
ENTRYPOINT ["/shap-planner-backend"]
|
||||||
Reference in New Issue
Block a user