-
-
Notifications
You must be signed in to change notification settings - Fork 79
/
slim.Dockerfile
50 lines (39 loc) · 1.26 KB
/
slim.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
FROM python:3.11-slim as builder
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
# Installs Aleo module build dependencies
RUN set -eux; \
apt-get update; \
apt-get install -y --no-install-recommends \
git \
curl \
build-essential \
pkg-config \
libssl-dev \
;
# Installs Rust compiler
RUN set -eux; \
curl https://sh.rustup.rs | bash -s -- -y
ENV PATH="${PATH}:/root/.cargo/bin"
# Builds aleo rust module wheel
RUN set -eux; \
pip install setuptools-rust --no-cache-dir; \
git clone https://github.com/HarukaMa/aleo-explorer-rust.git ; \
pip wheel -w /dist/ ./aleo-explorer-rust
# Clones repo
RUN set -eux; \
git clone https://github.com/HarukaMa/aleo-explorer.git /app/
# Builds requirements wheels
RUN set -eux; \
pip wheel -w /dist/ -r /app/requirements.txt
FROM python:3.11-slim as runtime
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
COPY --from=builder /app/ /app/
# Installs wheels from builder
RUN --mount=source=/dist/,target=/dist/,from=builder \
pip install --no-cache-dir --no-index /dist/*.whl
WORKDIR /app/
RUN adduser -u 5678 --disabled-password --gecos "" appuser && chown -R appuser /app
USER appuser
CMD ["python", "-m", "main"]