2020-10-15 12:12:31 -04:00
|
|
|
FROM golang:1.14.2-alpine3.11 AS backend-builder
|
|
|
|
COPY . /app
|
2020-10-29 06:50:19 -04:00
|
|
|
#RUN apk --no-cache add build-base git gcc
|
|
|
|
RUN cd /app && env CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags='-extldflags "-static" -s -w' -o openvpn-admin
|
2020-10-15 12:12:31 -04:00
|
|
|
|
|
|
|
FROM node:14.2-alpine3.11 AS frontend-builder
|
|
|
|
COPY frontend/ /app
|
|
|
|
RUN cd /app && npm install && npm run build
|
|
|
|
|
2021-02-15 01:03:38 -05:00
|
|
|
FROM golang:1.14.2-buster AS user-builder
|
|
|
|
RUN git clone https://github.com/pashcovich/openvpn-user /app && cd /app && env CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -ldflags='-linkmode external -extldflags "-static" -s -w' -o openvpn-user
|
|
|
|
|
|
|
|
FROM alpine:3.13
|
2020-10-15 12:12:31 -04:00
|
|
|
WORKDIR /app
|
2020-10-29 06:50:19 -04:00
|
|
|
COPY --from=backend-builder /app/openvpn-admin /app
|
2021-02-15 01:03:38 -05:00
|
|
|
COPY --from=user-builder /app/openvpn-user /usr/local/bin
|
2020-10-15 12:12:31 -04:00
|
|
|
COPY --from=frontend-builder /app/static /app/static
|
2020-10-29 06:50:19 -04:00
|
|
|
COPY client.conf.tpl /app/client.conf.tpl
|
|
|
|
COPY ccd.tpl /app/ccd.tpl
|
2021-02-15 01:03:38 -05:00
|
|
|
RUN apk add --update bash easy-rsa && \
|
2020-10-15 12:12:31 -04:00
|
|
|
ln -s /usr/share/easy-rsa/easyrsa /usr/local/bin && \
|
|
|
|
rm -rf /tmp/* /var/tmp/* /var/cache/apk/* /var/cache/distfiles/*
|