File size: 1,664 Bytes
7f50cd1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
FROM python:3.11-slim-bookworm@sha256:31feac62e3aa66d2cdddb4e1f80f839d8f14ad02b98b77e7eee90df6dc65f0c5
RUN pip install --no-cache-dir numpy==1.26.4 scipy==1.11.4 scikit-learn==1.3.2 joblib==1.6.0 cloudpickle==3.1.2 threadpoolctl==3.7.0
ENV OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 MKL_NUM_THREADS=1 PYTHONDONTWRITEBYTECODE=1
WORKDIR /app/core

# ---- the toolchain both sides carry ----
# A compiled method must build where it is graded, not only where it was written.
RUN apt-get update \
    && apt-get install -y --no-install-recommends gcc g++ make \
    && rm -rf /var/lib/apt/lists/*

# ---- the package's layers ----
USER root
ENV OMP_NUM_THREADS=4 OPENBLAS_NUM_THREADS=4 MKL_NUM_THREADS=4 NUMEXPR_NUM_THREADS=4 PYTHONDONTWRITEBYTECODE=1 CORE_DIR=/app/core
WORKDIR /tests
COPY package_common.py runner.py grade.py test.sh sealed.json reward_scale.py reward_scale.json /tests/
RUN chmod 0755 /tests/test.sh     && chown root:root /tests/sealed.json /tests/reward_scale.json && chmod 0400 /tests/sealed.json /tests/reward_scale.json

# The method runs in this container, so the core's code it may import is here too, at the same
# path as on the agent side.
COPY core/ /app/core/
RUN chmod -R a+rX /app/core

# The sealed instances and their answers: readable by root only.
COPY data/ /tests/data/
COPY data-answers/ /tests/data-answers/
RUN chown -R root:root /tests/data /tests/data-answers \
    && find /tests/data /tests/data-answers -type d -exec chmod 0500 {} + \
    && find /tests/data /tests/data-answers -type f -exec chmod 0400 {} + \
    && chmod 0700 /tests

RUN groupadd -g 4242 solver && useradd -u 4242 -g 4242 -M -s /usr/sbin/nologin solver