webdav-go/Dockerfile
Lennard Brinkhaus bf8d5574e9
Some checks failed
continuous-integration/drone/push Build is failing
Create folder and Copy with permissions
2022-01-10 18:10:19 +01:00

34 lines
698 B
Docker

# build stage
FROM golang:1.16-stretch AS build-env
WORKDIR /src
COPY go.mod /src/go.mod
RUN go mod download
COPY . /src
RUN mkdir /webdav/root && chown -R 101:101 /webdav
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
USER 101
COPY --from=build-env --chown=101:101 /webdav /webdav
COPY --from=build-env /src/app .
ENTRYPOINT [ "./app" ]