Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
56 lines (43 loc) · 1.56 KB
/
Copy pathDockerfile
File metadata and controls
56 lines (43 loc) · 1.56 KB
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
FROM python:3.13-slim-bookworm
WORKDIR /app
# Install OS-level dependencies securely
RUN apt-get update && \
apt-get install -y --no-install-recommends build-essential libffi-dev libssl-dev && \
rm -rf /var/lib/apt/lists/*
# Install project requirements
COPY requirements.txt .
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
# Copy source code
COPY ./pyjamaz ./pyjamaz
COPY ./scripts ./scripts
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV PYTHONPATH="/app"
RUN mkdir -p /app/numba-cache
ENV NUMBA_CACHE_DIR="/app/numba-cache/"
# https://numba.pydata.org/numba-doc/dev/reference/envvars.html
ENV NUMBA_CACHE=1
ENV NUMBA_DISABLE_PERFORMANCE_WARNINGS=1
ENV NUMBA_BOUNDSCHECK=0
ENV NUMBA_EAGERNESS=1
ENV NUMBA_LOOP_VECTORIZE=1
ENV NUMBA_ENABLE_AVX=1
ENV NUMBA_OPT=3
ENV NUMBA_DEBUG=0
ENV NUMBA_DEBUGINFO=0
ENV PVM_INTERPRETER=NUMBA_AOT
# Trigger compilation of the numba PVM interpreter
RUN ./scripts/build_numba_aot.sh
RUN python -m compileall -b -d /app ./pyjamaz && \
find ./pyjamaz -name "*.py" -type f \
! -path "./pyjamaz/pvm/interpreters/numba/*" \
-delete && \
rm -rf ./pyjamaz/pvm/interpreters/numba/__pycache__ && \
chmod +x ./scripts/docker-entrypoint.sh && \
chmod -R 777 /app/numba-cache && \
chmod -R 777 /app/pyjamaz/pvm/interpreters/numba
# Verify a fresh process can execute the PVM from cache after source stripping.
# This runs for each target architecture and must succeed before image export.
RUN python ./scripts/check_numba_cache.py
ENTRYPOINT ["./scripts/docker-entrypoint.sh"]