1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
ARG src_dir="/octorpki"
FROM golang:alpine as builder
ARG src_dir
ARG LDFLAGS=""
RUN apk --update --no-cache add git && \
mkdir -p ${src_dir}
WORKDIR ${src_dir}
COPY . .
RUN go build -ldflags "${LDFLAGS}" cmd/octorpki/octorpki.go
FROM alpine:latest
ARG src_dir
RUN apk --update --no-cache add ca-certificates rsync && \
adduser -S -D -H -h / rpki && \
mkdir /cache && chmod 770 /cache && chown rpki:root /cache && \
touch rrdp.json && chown rpki rrdp.json
USER rpki
COPY --from=builder ${src_dir}/octorpki ${src_dir}/cmd/octorpki/private.pem /
COPY --from=builder ${src_dir}/cmd/octorpki/tals /tals
VOLUME ["/cache"]
ENTRYPOINT ["./octorpki"]
|