2022-07-21 11:17:53 -04:00
|
|
|
FROM node:16-alpine3.15 AS frontend-builder
|
2020-10-15 12:12:31 -04:00
|
|
|
COPY frontend/ /app
|
|
|
|
RUN cd /app && npm install && npm run build
|
|
|
|
|
2021-11-29 04:57:45 -05:00
|
|
|
FROM golang:1.17.3-buster AS backend-builder
|
2021-02-26 07:11:13 -05:00
|
|
|
COPY --from=frontend-builder /app/static /app/frontend/static
|
|
|
|
COPY . /app
|
2022-12-30 09:25:21 -05:00
|
|
|
RUN cd /app && env CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -a -tags netgo -ldflags '-linkmode external -extldflags -static -s -w' -o ovpn-admin
|
2021-02-26 07:11:13 -05:00
|
|
|
|
2022-07-21 11:17:53 -04:00
|
|
|
FROM alpine:3.16
|
2020-10-15 12:12:31 -04:00
|
|
|
WORKDIR /app
|
2022-12-30 09:25:21 -05:00
|
|
|
RUN apk add --update bash easy-rsa openssl openvpn coreutils iptables curl&& \
|
2020-10-15 12:12:31 -04:00
|
|
|
ln -s /usr/share/easy-rsa/easyrsa /usr/local/bin && \
|
2022-12-30 09:25:21 -05:00
|
|
|
wget https://github.com/pashcovich/openvpn-user/releases/download/v1.0.9/openvpn-user-linux-amd64.tar.gz -O - | tar xz -C /usr/local/bin && \
|
2020-10-15 12:12:31 -04:00
|
|
|
rm -rf /tmp/* /var/tmp/* /var/cache/apk/* /var/cache/distfiles/*
|
2022-12-30 09:25:21 -05:00
|
|
|
COPY --from=backend-builder /app/ovpn-admin /app
|
|
|
|
COPY setup/ /etc/openvpn/setup
|
|
|
|
RUN chmod +x /etc/openvpn/setup/configure.sh
|