-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
72 lines (57 loc) · 1.79 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
# syntax=docker.io/docker/dockerfile:1.4
# Need to use Debian-based image because solc >= 0.6 requires modern glibc instead of musl
FROM node:20-bookworm as base
# This stage installs system dependencies for building the node projects
FROM base as builder
# Install build dependencies
RUN apt update && \
DEBIAN_FRONTEND="noninteractive" apt install -y \
bash \
git \
jq \
make \
patch \
tar \
wget && \
rm -rf /var/lib/apt/lists/*
# Build and install Python from source
ENV PYTHON_VERSION="3.11.4"
RUN wget "https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tgz"
RUN tar -zvxf "Python-${PYTHON_VERSION}.tgz" # --directory="${PYTHON_EXTRACT_DIR}"
RUN cd "Python-${PYTHON_VERSION}" && \
./configure \
--prefix="/usr" \
--with-pydebug \
--enable-shared
RUN make -C "Python-${PYTHON_VERSION}" -j$(getconf _NPROCESSORS_ONLN) install
# Update Python dependencies
RUN python3 -m pip install --upgrade --break-system-packages Cython pip setuptools wheel
# This stage copies the project and build it
FROM builder as ultrachess-builder
WORKDIR /app/contracts
# Build depends
COPY tools tools
COPY .prettierrc .
RUN ./tools/build-depends.sh
# Clean up depends
RUN rm -rf tools
# Install yarn dependencies
COPY package.json yarn.lock .
RUN yarn install --non-interactive
# Build contracts and typechain code
COPY contracts/src contracts/src
COPY contracts/test contracts/test
COPY hardhat.config.ts .
RUN yarn compile
# Copy deployment scripts
COPY deploy deploy
COPY src src
# This stage is the runtime image
FROM base as ultrachess-deployer
# Pull in the latest npm to avoid update notices in the log
RUN npm install -g npm
# Copy yarn build
COPY --from=ultrachess-builder /app /app
WORKDIR /app/contracts
ENTRYPOINT ["npx", "hardhat"]
CMD ["deploy"]