Files
lk-jwt-service/Dockerfile
Gaël Goinvic e10a9fd256 Fix DNS resolution with host aliases + Fix TLS Verifiy on default transport (#92)
* Fix DNS resolution with host aliases

* Disable TLS on the default transport if required
2025-04-04 16:09:19 +02:00

29 lines
751 B
Docker

# Set the version to match that which is in go.mod
ARG GO_VERSION="build-arg-must-be-provided"
FROM --platform=${BUILDPLATFORM} golang:${GO_VERSION}-alpine AS builder
WORKDIR /proj
COPY go.mod ./
COPY go.sum ./
RUN go mod download
COPY *.go ./
ARG TARGETOS TARGETARCH
RUN GOOS=$TARGETOS GOARCH=$TARGETARCH go build -o lk-jwt-service
# set up nsswitch.conf for Go's "netgo" implementation
# - https://github.com/golang/go/blob/go1.24.0/src/net/conf.go#L343
RUN echo 'hosts: files dns' > /etc/nsswitch.conf
FROM scratch
COPY --from=builder /proj/lk-jwt-service /lk-jwt-service
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder /etc/nsswitch.conf /etc/nsswitch.conf
EXPOSE 8080
CMD [ "/lk-jwt-service" ]