Dockerfile solves #10
parent
99bdf4e320
commit
9e41b707bf
@ -0,0 +1 @@
|
||||
Dockerfile
|
@ -0,0 +1,32 @@
|
||||
FROM golang:alpine as builder
|
||||
|
||||
ENV GO111MODULE=on
|
||||
|
||||
# Create the user and group files to run unprivileged
|
||||
RUN mkdir /user && \
|
||||
echo 'nobody:x:65534:65534:nobody:/:' > /user/passwd && \
|
||||
echo 'nobody:x:65534:' > /user/group
|
||||
|
||||
RUN apk update && apk add --no-cache git ca-certificates tzdata sqlite build-base
|
||||
RUN mkdir /build
|
||||
COPY . /build/
|
||||
WORKDIR /build
|
||||
|
||||
COPY ./ ./
|
||||
RUN CGO_ENABLED=1 GOOS=linux go build -a -installsuffix cgo -ldflags '-extldflags "-static"' -o bog .
|
||||
|
||||
FROM golang:alpine AS final
|
||||
LABEL author="Cajually <me@caj.me>"
|
||||
|
||||
COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo
|
||||
COPY --from=builder /user/group /user/passwd /etc/
|
||||
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
|
||||
COPY --from=builder /build/bog /
|
||||
COPY --from=builder /build/default.toml /
|
||||
|
||||
WORKDIR /
|
||||
|
||||
USER nobody:nobody
|
||||
ENTRYPOINT ["/bog"]
|
||||
|
||||
EXPOSE 8002
|
Loading…
Reference in New Issue