mirror of
https://github.com/bgp/stayrtr.git
synced 2024-05-06 15:54:54 +00:00
58 lines
1.2 KiB
Docker
58 lines
1.2 KiB
Docker
|
###############
|
||
|
# Build stage #
|
||
|
###############
|
||
|
ARG src_dir="/stayrtr"
|
||
|
|
||
|
FROM golang:alpine as builder
|
||
|
ARG src_dir
|
||
|
|
||
|
RUN apk --update --no-cache add git make && \
|
||
|
mkdir -p ${src_dir}
|
||
|
|
||
|
WORKDIR ${src_dir}
|
||
|
COPY . .
|
||
|
|
||
|
RUN SUFFIX= make build-all
|
||
|
|
||
|
################
|
||
|
# Keygen stage #
|
||
|
################
|
||
|
FROM alpine:latest as keygen
|
||
|
|
||
|
RUN apk --update --no-cache add openssl
|
||
|
RUN openssl ecparam -genkey -name prime256v1 -noout -outform pem > private.pem
|
||
|
|
||
|
#################
|
||
|
# StayRTR stage #
|
||
|
#################
|
||
|
FROM alpine:latest AS stayrtr
|
||
|
|
||
|
RUN apk --update --no-cache add ca-certificates && \
|
||
|
adduser -S -D -H -h / rtr
|
||
|
USER rtr
|
||
|
COPY --from=builder /stayrtr/dist/stayrtr /
|
||
|
COPY --from=keygen /private.pem /private.pem
|
||
|
ENTRYPOINT ["./stayrtr"]
|
||
|
|
||
|
#################
|
||
|
# RTRdump stage #
|
||
|
#################
|
||
|
FROM alpine:latest AS rtrdump
|
||
|
|
||
|
RUN apk --update --no-cache add ca-certificates && \
|
||
|
adduser -S -D -H -h / rtr
|
||
|
USER rtr
|
||
|
COPY --from=builder /stayrtr/dist/rtrdump /
|
||
|
ENTRYPOINT ["./rtrdump"]
|
||
|
|
||
|
#################
|
||
|
# RTRmon stage #
|
||
|
#################
|
||
|
FROM alpine:latest AS rtrmon
|
||
|
|
||
|
RUN apk --update --no-cache add ca-certificates && \
|
||
|
adduser -S -D -H -h / rtr
|
||
|
USER rtr
|
||
|
COPY --from=builder /stayrtr/dist/rtrmon /
|
||
|
ENTRYPOINT ["./rtrmon"]
|