Add CA certs to scratch runtime; tested and actually works
This commit is contained in:
15
Dockerfile
15
Dockerfile
@@ -1,26 +1,17 @@
|
|||||||
FROM --platform=$BUILDPLATFORM golang:alpine AS build
|
FROM --platform=$BUILDPLATFORM golang:alpine AS build
|
||||||
|
|
||||||
ARG TARGETARCH
|
ARG TARGETARCH
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
|
RUN apk --no-cache add git ca-certificates
|
||||||
RUN apk --no-cache add git
|
|
||||||
|
|
||||||
COPY go.mod go.sum ./
|
COPY go.mod go.sum ./
|
||||||
RUN go mod download
|
RUN go mod download
|
||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
RUN go run github.com/swaggo/swag/cmd/swag@latest init --parseDependency
|
RUN go run github.com/swaggo/swag/cmd/swag@latest init --parseDependency
|
||||||
|
|
||||||
ENV CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH}
|
ENV CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH}
|
||||||
RUN go build -ldflags="-s -w" -o /src/mozhi ./ # adjust path if needed
|
RUN go build -ldflags="-s -w" -o /src/mozhi .
|
||||||
|
|
||||||
FROM scratch AS runtime
|
FROM scratch AS runtime
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
||||||
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
|
|
||||||
|
|
||||||
COPY --from=build /src/mozhi /app/mozhi
|
COPY --from=build /src/mozhi /app/mozhi
|
||||||
|
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
ENTRYPOINT ["/app/mozhi", "serve"]
|
ENTRYPOINT ["/app/mozhi", "serve"]
|
||||||
|
|||||||
Reference in New Issue
Block a user