2024-09-16 11:55:34 -07:00
|
|
|
ARG BUILDPLATFORM="linux/amd64"
|
|
|
|
FROM --platform=${BUILDPLATFORM} docker.io/golang:1.21.9-bullseye@sha256:311468bffa9fa4747a334b94e6ce3681b564126d653675a6adc46698b2b88d35 AS build
|
2022-12-01 06:13:48 -08:00
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
2023-03-07 11:25:42 -08:00
|
|
|
COPY spy spy
|
|
|
|
COPY common common
|
2022-12-01 06:13:48 -08:00
|
|
|
|
2022-12-14 12:07:55 -08:00
|
|
|
# Build the Go app
|
2023-03-07 11:25:42 -08:00
|
|
|
RUN cd spy && CGO_ENABLED=0 GOOS=linux go build -o "./spy" cmd/main.go
|
2022-12-01 06:13:48 -08:00
|
|
|
|
2022-12-14 12:07:55 -08:00
|
|
|
############################
|
|
|
|
# STEP 2 build a small image
|
|
|
|
############################
|
|
|
|
FROM alpine
|
|
|
|
#Copy certificates
|
|
|
|
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
|
|
|
|
# Copy our static executable.
|
2023-03-07 11:25:42 -08:00
|
|
|
COPY --from=build "/app/spy/spy" "/spy"
|
2022-12-14 12:07:55 -08:00
|
|
|
# Run the binary.
|
2022-12-01 06:13:48 -08:00
|
|
|
ENTRYPOINT ["/spy"]
|