2024-08-22 00:55:14 +00:00
|
|
|
FROM golang:1.22.1-alpine3.19 AS build
|
2022-12-28 00:27:37 -05:00
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
2023-08-21 11:34:45 +05:30
|
|
|
COPY go.mod .
|
|
|
|
COPY go.sum .
|
2022-12-28 00:27:37 -05:00
|
|
|
|
|
|
|
RUN go mod download
|
|
|
|
|
2023-08-21 11:34:45 +05:30
|
|
|
COPY . .
|
|
|
|
|
2024-08-22 00:55:14 +00:00
|
|
|
# Architecture and OS are set dynamically (by BuildKit)
|
|
|
|
ARG TARGETOS
|
|
|
|
ARG TARGETARCH
|
|
|
|
ENV CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH
|
2023-08-21 11:34:45 +05:30
|
|
|
|
2024-07-03 20:40:40 +02:00
|
|
|
RUN go build -o anonymousoverflow && go build -o healthcheck ./src/healthcheck
|
2023-08-21 11:34:45 +05:30
|
|
|
|
|
|
|
FROM scratch
|
2022-12-28 00:27:37 -05:00
|
|
|
|
2023-08-21 11:34:45 +05:30
|
|
|
COPY --from=build /app/anonymousoverflow /anonymousoverflow
|
2024-07-03 20:40:40 +02:00
|
|
|
COPY --from=build /app/healthcheck /healthcheck
|
2023-08-21 11:34:45 +05:30
|
|
|
COPY templates /templates
|
|
|
|
COPY public /public
|
|
|
|
COPY --from=build /etc/ssl/certs /etc/ssl/certs
|
2022-12-28 00:27:37 -05:00
|
|
|
|
2024-07-03 20:40:40 +02:00
|
|
|
HEALTHCHECK --interval=60s --timeout=5s --start-period=2s --retries=3 CMD [ "/healthcheck","http://localhost:8080/healthz" ]
|
|
|
|
|
2022-12-28 00:27:37 -05:00
|
|
|
EXPOSE 8080
|
|
|
|
|
|
|
|
CMD ["/anonymousoverflow"]
|