-
Notifications
You must be signed in to change notification settings - Fork 6
/
Dockerfile
88 lines (82 loc) · 2.7 KB
/
Dockerfile
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# Define the BUILD_MODE argument with a default value of "production"
ARG BUILD_MODE=production
ARG TARGETPLATFORM=linux/amd64
# Operating system with basic tools
FROM ubuntu:20.04 AS base
SHELL ["bash", "-c"]
ENV TZ=UTC
ENV LC_ALL=C.UTF-8
ENV LANG=C.UTF-8
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone && \
apt -yq update && \
apt -yqq install --no-install-recommends curl ca-certificates \
build-essential pkg-config libssl-dev llvm-dev liblmdb-dev clang cmake \
git jq npm xxd file curl unzip
# Code specific dependencies
FROM base AS builder
SHELL ["bash", "-c"]
WORKDIR /code
ARG BUILD_MODE
ENV RUSTUP_HOME=/opt/rustup \
CARGO_HOME=/opt/cargo \
FNM_DIR=/opt/fnm \
BUILD_MODE=${BUILD_MODE}
# Path modifications need to be done in separate ENV statements
ENV PATH=$CARGO_HOME/bin:$PATH
ENV PATH=$FNM_DIR/bin:$PATH
# Install Rust and the Node.js version manager
COPY rust-toolchain.toml .
RUN curl -fsSL https://sh.rustup.rs -sSf | sh -s -- -y --no-modify-path && \
curl -fsSL https://fnm.vercel.app/install | bash -s -- --install-dir $FNM_DIR/bin --skip-shell
# Add the fnm env var envaluation to the bashrc to enable it in bash by default
RUN echo "eval \"$(fnm env)\"" >> $HOME/.bashrc
# Add expected node version file and root package.json with expected pnpm version
COPY .nvmrc .
COPY package.json .
# Install the node version specified in the version file
RUN eval "$(fnm env)" && \
fnm install && \
fnm use && \
corepack enable && \
fnm alias default production
# Install the monorepo dependencies
COPY . .
RUN eval "$(fnm env)" && \
fnm use && \
pnpm install --frozen-lockfile
# Build the Orbit Upgrader Canister
FROM builder AS build_upgrader
SHELL ["bash", "-c"]
WORKDIR /code
LABEL io.icp.artifactType="canister" \
io.icp.artifactName="upgrader"
RUN eval "$(fnm env)" && \
fnm use && \
npx nx run upgrader:create-artifacts
# Build the Orbit Station Canister
FROM builder AS build_station
SHELL ["bash", "-c"]
WORKDIR /code
LABEL io.icp.artifactType="canister" \
io.icp.artifactName="station"
RUN eval "$(fnm env)" && \
fnm use && \
npx nx run station:create-artifacts
# Build the Orbit Control Panel
FROM builder AS build_control_panel
SHELL ["bash", "-c"]
WORKDIR /code
LABEL io.icp.artifactType="canister" \
io.icp.artifactName="control-panel"
RUN eval "$(fnm env)" && \
fnm use && \
npx nx run control-panel:create-artifacts
# Build the Orbit Wallet Frontend Assets
FROM builder AS build_wallet_dapp
SHELL ["bash", "-c"]
WORKDIR /code
LABEL io.icp.artifactType="canister" \
io.icp.artifactName="wallet-dapp"
RUN eval "$(fnm env)" && \
fnm use && \
npx nx run wallet-dapp:create-artifacts