You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
971 B
Docker
42 lines
971 B
Docker
FROM golang:alpine as builder
|
|
|
|
ENV GO111MODULE=on
|
|
|
|
ENV USER=appuser
|
|
ENV UID=1000
|
|
RUN adduser \
|
|
--disabled-password \
|
|
--gecos "" \
|
|
--home "/nonexistent" \
|
|
--shell "/sbin/nologin" \
|
|
--no-create-home \
|
|
--uid "${UID}" \
|
|
"${USER}"
|
|
|
|
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 scratch AS final
|
|
LABEL author="Cajually <me@caj.me>"
|
|
|
|
COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo
|
|
COPY --from=builder /etc/passwd /etc/passwd
|
|
COPY --from=builder /etc/group /etc/group
|
|
|
|
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
|
|
COPY --from=builder /build/bog /
|
|
COPY --from=builder /build/server/views /server/views
|
|
COPY --from=builder /build/default.toml /
|
|
|
|
WORKDIR /
|
|
|
|
USER appuser:appuser
|
|
ENTRYPOINT ["/bog"]
|
|
|
|
EXPOSE 8002
|