🐳 Add Dockerfile

This commit is contained in:
Andreas Schneider 2020-10-18 15:50:49 +02:00
parent 5a8750e637
commit 43ddb362a9
2 changed files with 24 additions and 2 deletions

22
Dockerfile Normal file
View File

@ -0,0 +1,22 @@
FROM golang:1.15 AS builder
RUN mkdir /data && mkdir /data/shares
ADD . /src
WORKDIR /src
ENV CGO_ENABLED=0
RUN go build .
# Actual image
FROM scratch
ENV DATA_DIR=/data/shares
ENV DATABASE=/data/ShareDAV.db
COPY --from=builder /src/ShareDAV /app/ShareDAV
COPY --from=builder /data /data
ENTRYPOINT ["/app/ShareDAV"]
CMD ["serve"]

View File

@ -35,8 +35,8 @@ import (
)
type config struct {
DataDirectory string `name:"data-dir" default:"data" help:"Directory to store all files in."`
Db string `name:"db" default:"ShareDAV.db" help:"Database file to use."`
DataDirectory string `name:"data-dir" default:"data" help:"Directory to store all files in." env:"DATA_DIR"`
Db string `name:"db" default:"ShareDAV.db" help:"Database file to use." env:"DATABASE"`
}
type app struct {