-
Notifications
You must be signed in to change notification settings - Fork 14
/
Dockerfile
57 lines (45 loc) · 1.2 KB
/
Dockerfile
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
###############
# 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"]