11# #########################
22# Build dependencies
33# #########################
4- FROM alpine:3.9 as build
4+ # --platform=$BUILDPLATFORM is used build javascript source with host arch
5+ # Otherwise webpack builds on emulated archs can be extremely slow (+1h)
6+ FROM --platform=${BUILDPLATFORM:-amd64} node:10.19.0-alpine as build
57
68WORKDIR /usr/src/app
79
810RUN apk add --update --no-cache \
9- build-base python libpcap-dev linux-headers bash nodejs yarn npm
11+ build-base python libpcap-dev linux-headers bash
1012
1113COPY build/src/package.json ./
1214COPY build/src/yarn.lock ./
@@ -31,7 +33,7 @@ RUN yarn build
3133# #########################
3234# Compute git data
3335# #########################
34- FROM alpine:3.9 as git-data
36+ FROM --platform=${BUILDPLATFORM:-amd64} node:10.19.0-alpine as git-data
3537
3638WORKDIR /usr/src/app
3739
@@ -45,15 +47,14 @@ RUN node getGitData /usr/src/app/.git-data.json
4547# #########################
4648# Build UI
4749# #########################
48- FROM alpine:3.9 as build-ui
50+ FROM --platform=${BUILDPLATFORM:-amd64} node:10.19.0-alpine as build-ui
4951
5052WORKDIR /usr/src/app
5153
5254# ensuring both package.json AND package-lock.json are copied
5355COPY build/ui_openvpn/package*.json ./
5456COPY build/ui_openvpn/*lock* ./
5557# install dependencies
56- RUN apk add --no-cache nodejs yarn
5758RUN yarn install --production
5859# copy the contents of the app
5960COPY build/ui_openvpn .
@@ -72,14 +73,7 @@ FROM alpine:3.9
7273WORKDIR /usr/src/app
7374
7475RUN apk add --update \
75- openvpn \
76- iptables \
77- bash \
78- easy-rsa \
79- openssl \
80- jq \
81- sed \
82- nodejs
76+ openvpn iptables bash easy-rsa openssl nodejs
8377RUN ln -s /usr/share/easy-rsa/easyrsa /usr/local/bin && \
8478 rm -rf /tmp/* /var/tmp/* /var/cache/apk/* /var/cache/distfiles/*
8579
0 commit comments