-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
80 lines (65 loc) · 2.2 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
# syntax=docker/dockerfile:1.4
# Use an official Ubuntu base image with platform support
FROM --platform=$TARGETPLATFORM ubuntu:20.04
# Set environment variables for non-interactive installs
ENV DEBIAN_FRONTEND=noninteractive
# Set the working directory inside the container
WORKDIR /app
# Install dependencies
RUN apt-get update && apt-get install -y \
curl \
wget \
git \
build-essential \
libsecret-1-dev \
pkg-config \
dbus \
libssl-dev \
libffi-dev \
python3-dev \
python3-pip \
python3-venv \
lsb-release \
software-properties-common \
xz-utils \
&& rm -rf /var/lib/apt/lists/*
# Generate the machine-id
RUN dbus-uuidgen > /etc/machine-id
# Set build arguments for architecture
ARG TARGETARCH
# Install Node.js 20
RUN NODE_VERSION=20.8.0 \
&& if [ "$TARGETARCH" = "arm64" ]; then \
ARCH="arm64"; \
elif [ "$TARGETARCH" = "amd64" ]; then \
ARCH="x64"; \
else \
echo "Unsupported architecture: $TARGETARCH"; exit 1; \
fi \
&& wget https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-$ARCH.tar.xz \
&& tar -xf node-v$NODE_VERSION-linux-$ARCH.tar.xz -C /usr/local --strip-components=1 \
&& rm node-v$NODE_VERSION-linux-$ARCH.tar.xz \
&& npm install -g npm@latest
# Install Chia Dev Tools from PyPI globally
RUN python3 -m pip install --upgrade pip && \
python3 -m pip install --extra-index-url https://pypi.chia.net/simple/ chia-dev-tools
# Copy the current directory contents into the container at /app
COPY . .
# Install NPM packages
RUN npm install
# Install architecture-specific datalayer driver
RUN if [ "$TARGETARCH" = "arm64" ]; then \
npm install @dignetwork/datalayer-driver-linux-arm64-gnu; \
elif [ "$TARGETARCH" = "amd64" ]; then \
npm install @dignetwork/datalayer-driver-linux-x64-gnu; \
else \
echo "Unsupported architecture: $TARGETARCH"; exit 1; \
fi
# Build the application
RUN npm run build
# Rebuild any native modules for the current environment
RUN npm rebuild
# Expose the port the app runs on
EXPOSE 4161
# Run the application
CMD ["node", "dist/cluster.js"]