2020-09-20 23:11:00 +00:00
|
|
|
## build image:
|
2020-09-21 20:00:28 +00:00
|
|
|
ARG GO_VERSION=1.15
|
|
|
|
FROM golang:${GO_VERSION}-alpine AS builder
|
|
|
|
|
|
|
|
RUN mkdir /user && \
|
|
|
|
echo 'nobody:x:65534:65534:nobody:/:' > /user/passwd && \
|
|
|
|
echo 'nobody:x:65534:' > /user/group
|
|
|
|
RUN apk add --no-cache ca-certificates git bzip2 make gcc libc-dev
|
2020-09-20 22:45:35 +00:00
|
|
|
|
2020-09-20 23:11:00 +00:00
|
|
|
RUN mkdir -p /go/src/git.eeqj.de/sneak/formless
|
|
|
|
WORKDIR /go/src/git.eeqj.de/sneak/formless
|
|
|
|
|
|
|
|
COPY go.mod .
|
|
|
|
COPY go.sum .
|
|
|
|
RUN go mod download
|
2020-09-20 22:45:35 +00:00
|
|
|
|
2020-09-21 20:00:28 +00:00
|
|
|
COPY ./ ./
|
2020-09-20 23:11:00 +00:00
|
|
|
RUN make build
|
2020-09-21 20:00:28 +00:00
|
|
|
RUN tar -c /go | bzip2 > /go.tbz2
|
2020-09-20 22:45:35 +00:00
|
|
|
|
2020-09-20 23:11:00 +00:00
|
|
|
## output image:
|
2020-09-21 20:00:28 +00:00
|
|
|
FROM scratch as final
|
|
|
|
COPY --from=builder /user/group /user/passwd /etc/
|
|
|
|
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
|
2020-09-20 23:11:00 +00:00
|
|
|
COPY --from=builder /go/src/git.eeqj.de/sneak/formless/formless /app/formless
|
2020-09-21 20:00:28 +00:00
|
|
|
COPY --from=builder /go.tbz2 /go.tbz2
|
2020-09-20 22:45:35 +00:00
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
ENV PORT 8080
|
|
|
|
ENV DBURL none
|
|
|
|
|
|
|
|
EXPOSE 8080
|
|
|
|
|
2020-09-21 20:00:28 +00:00
|
|
|
USER nobody:nobody
|
|
|
|
|
|
|
|
ENTRYPOINT ["./formless"]
|