-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathpyaleph.dockerfile
84 lines (65 loc) · 2.18 KB
/
pyaleph.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
FROM ubuntu:24.04 as base
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get -y upgrade && apt-get install -y software-properties-common
RUN add-apt-repository -y ppa:deadsnakes/ppa
# Runtime + build packages
RUN apt-get update && apt-get -y upgrade && apt-get install -y \
git \
libgmp-dev \
libpq5 \
python3.12
FROM base as builder
RUN openssl version
RUN cat /etc/ssl/openssl.cnf
RUN echo "$OPENSSL_CONF"
# Build-only packages
RUN apt-get update && apt-get install -y \
build-essential \
curl \
pkg-config \
python3.12-dev \
python3.12-venv \
libpq-dev \
software-properties-common
# Install Rust to build Python packages
RUN curl https://sh.rustup.rs > rustup-installer.sh
RUN sh rustup-installer.sh -y
ENV PATH="/root/.cargo/bin:${PATH}"
# Some packages (py-ed25519-bindings, required by substrate-interface) need the nightly
# Rust toolchain to be built at this time
RUN rustup default nightly
# Create virtualenv
RUN python3.12 -m venv /opt/venv
# Install pip
ENV PIP_NO_CACHE_DIR yes
RUN /opt/venv/bin/python3.12 -m pip install --upgrade pip wheel
ENV PATH="/opt/venv/bin:${PATH}"
RUN mkdir --parents /opt/pyaleph
WORKDIR /opt/pyaleph
COPY alembic.ini pyproject.toml ./
COPY LICENSE.txt README.md ./
COPY deployment/migrations ./deployment/migrations
COPY deployment/scripts ./deployment/scripts
COPY .git ./.git
COPY src ./src
RUN pip install -e .
FROM base
RUN groupadd -g 1000 -o aleph
RUN useradd -s /bin/bash -u 1000 -g 1000 -o aleph
COPY --from=builder --chown=aleph /opt/venv /opt/venv
COPY --from=builder --chown=aleph /opt/pyaleph /opt/pyaleph
RUN apt-get update && apt-get install -y \
libsodium23 \
libsodium-dev \
libgmp-dev
# OpenSSL 3 disabled some hash algorithms by default. They must be reenabled
# by enabling the "legacy" providers in /etc/ssl/openssl.cnf.
COPY ./deployment/docker-build/openssl.cnf.patch /etc/ssl/openssl.cnf.patch
RUN patch /etc/ssl/openssl.cnf /etc/ssl/openssl.cnf.patch
RUN mkdir /var/lib/pyaleph
RUN chown -R aleph:aleph /var/lib/pyaleph
ENV PATH="/opt/venv/bin:${PATH}"
RUN mkdir --parents /opt/pyaleph
WORKDIR /opt/pyaleph
USER aleph
ENTRYPOINT ["bash", "deployment/scripts/run_aleph_ccn.sh"]