2022-01-10 16:31:57 +00:00
|
|
|
# build stage
|
|
|
|
FROM golang:1.16-stretch AS build-env
|
|
|
|
|
|
|
|
WORKDIR /src
|
|
|
|
|
|
|
|
COPY go.mod /src/go.mod
|
|
|
|
RUN go mod download
|
|
|
|
|
|
|
|
COPY . /src
|
|
|
|
|
|
|
|
ENV GO113MODULE=on
|
|
|
|
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -ldflags '-extldflags "-static"' -o app .
|
|
|
|
|
|
|
|
# cert stage
|
|
|
|
FROM alpine:latest as certs
|
|
|
|
RUN apk --update add ca-certificates
|
|
|
|
|
|
|
|
# final stage
|
|
|
|
FROM scratch
|
|
|
|
LABEL maintainer="Lennard Brinkhaus <lennard.brinkhaus@dragse.de>"
|
|
|
|
|
|
|
|
COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
2022-01-10 17:02:30 +00:00
|
|
|
RUN mkdir /webdav/root && chown -R 101:101 /webdav
|
|
|
|
|
2022-01-10 16:31:57 +00:00
|
|
|
USER 101
|
|
|
|
|
|
|
|
COPY --from=build-env /src/app .
|
|
|
|
|
2022-01-10 17:02:30 +00:00
|
|
|
ENTRYPOINT [ "./app" ]
|