79259709

Date: 2024-12-07 00:15:16
Score: 1
Natty:
Report link

syntax=docker/dockerfile:1.4

FROM --platform=${BUILDPLATFORM} golang:1.22 AS builder

Set up working directory

WORKDIR /workspace

Arguments for cross-platform build

ARG TARGETPLATFORM ARG TARGETOS ARG TARGETARCH

Display build platform and target platform for debugging

RUN echo "Building for $TARGETPLATFORM ($TARGETOS/$TARGETARCH)"

Copy source files

COPY . .

Build the application

RUN make build

Final image stage

FROM --platform=${TARGETPLATFORM} debian:bullseye-slim WORKDIR /app

Copy the built binary from the builder stage

COPY --from=builder /workspace/ /app/

Specify entrypoint or CMD (replace with your binary name)

ENTRYPOINT ["./"]

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Low reputation (1):
Posted by: Muhammed Salama