-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.frontend
37 lines (28 loc) · 1.05 KB
/
Dockerfile.frontend
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
36
37
FROM --platform=linux/amd64 ubuntu@sha256:bbf3d1baa208b7649d1d0264ef7d522e1dc0deeeaaf6085bf8e4618867f03494 AS deps
# Note: The above is ubuntu 22.04
# Install required tools
RUN DEBIAN_FRONTEND=noninteractive apt update && apt install -y \
curl \
&& rm -rf /var/lib/apt/lists/*
# Install node
RUN curl --fail -sSf https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
ENV NVM_DIR=/root/.nvm
COPY .node-version .node-version
RUN . "$NVM_DIR/nvm.sh" && nvm install "$(cat .node-version)"
RUN . "$NVM_DIR/nvm.sh" && nvm use "v$(cat .node-version)"
RUN . "$NVM_DIR/nvm.sh" && nvm alias default "v$(cat .node-version)"
RUN ln -s "$NVM_DIR/versions/node/v$(cat .node-version)" "$NVM_DIR/versions/node/default"
ENV PATH="$NVM_DIR/versions/node/default/bin/:${PATH}"
RUN node --version
RUN npm --version
FROM deps AS build_frontend
COPY . .
ARG network="staging"
ENV ENV=$network
ENV DFX_NETWORK=$network
RUN echo $ENV
RUN echo $DFX_NETWORK
RUN npm ci
RUN npm run build
FROM scratch AS scratch_frontend
COPY --from=build_frontend /build /frontend