forked from arriven/db1000n
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
35 lines (25 loc) · 951 Bytes
/
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
FROM golang:1.17 as builder
WORKDIR /build
# pre-copy/cache go.mod for pre-downloading dependencies and only redownloading them in subsequent builds if they change
COPY go.mod .
RUN go mod download && go mod verify
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -a -o main .
FROM alpine:3.11.3 as openvpn
RUN apk add --update supervisor openvpn curl && rm -rf /tmp/* /var/cache/apk/*
ADD supervisord/supervisord.conf /etc/
ADD supervisord/supervisord-openvpn.conf \
supervisord/supervisord-db1000n.conf /etc/supervisor/conf.d/
ADD run/openvpn-up.sh \
run/run-openvpn.sh \
run/db1000n.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/openvpn-up.sh \
/usr/local/bin/run-openvpn.sh \
/usr/local/bin/db1000n.sh
WORKDIR /usr/src/app
COPY --from=builder /build/main .
ENTRYPOINT ["supervisord", "--configuration", "/etc/supervisord.conf"]
FROM alpine:3.11.3
WORKDIR /usr/src/app
COPY --from=builder /build/main .
CMD ["./main"]