2022-07-21 17:17:53 +02:00
|
|
|
FROM node:16-alpine3.15 AS frontend-builder
|
2020-10-15 18:12:31 +02:00
|
|
|
COPY frontend/ /app
|
2023-09-04 18:24:13 +02:00
|
|
|
RUN apk add --update python3 make g++ && cd /app && npm install && npm run build
|
2020-10-15 18:12:31 +02:00
|
|
|
|
2021-11-29 11:57:45 +02:00
|
|
|
FROM golang:1.17.3-buster AS backend-builder
|
|
|
|
RUN go install github.com/gobuffalo/packr/v2/packr2@latest
|
2021-02-26 14:11:13 +02:00
|
|
|
COPY --from=frontend-builder /app/static /app/frontend/static
|
|
|
|
COPY . /app
|
2023-09-04 18:24:13 +02:00
|
|
|
ARG TARGETARCH
|
|
|
|
RUN cd /app && packr2 && env CGO_ENABLED=1 GOOS=linux GOARCH=${TARGETARCH} go build -a -tags netgo -ldflags '-linkmode external -extldflags -static -s -w' -o ovpn-admin && packr2 clean
|
2021-02-26 14:11:13 +02:00
|
|
|
|
2022-07-21 17:17:53 +02:00
|
|
|
FROM alpine:3.16
|
2020-10-15 18:12:31 +02:00
|
|
|
WORKDIR /app
|
2021-03-17 11:05:37 +02:00
|
|
|
COPY --from=backend-builder /app/ovpn-admin /app
|
2023-09-04 18:24:13 +02:00
|
|
|
ARG TARGETARCH
|
2022-07-21 17:17:53 +02:00
|
|
|
RUN apk add --update bash easy-rsa openssl openvpn coreutils && \
|
2020-10-15 18:12:31 +02:00
|
|
|
ln -s /usr/share/easy-rsa/easyrsa /usr/local/bin && \
|
2023-09-04 18:24:13 +02:00
|
|
|
wget https://github.com/pashcovich/openvpn-user/releases/download/v1.0.4/openvpn-user-linux-${TARGETARCH}.tar.gz -O - | tar xz -C /usr/local/bin && \
|
2020-10-15 18:12:31 +02:00
|
|
|
rm -rf /tmp/* /var/tmp/* /var/cache/apk/* /var/cache/distfiles/*
|
2023-09-04 18:24:13 +02:00
|
|
|
RUN if [ -f "/usr/local/bin/openvpn-user-${TARGETARCH}" ]; then ln -s /usr/local/bin/openvpn-user-${TARGETARCH} /usr/local/bin/openvpn-user; fi
|