-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.pqc
More file actions
59 lines (47 loc) · 1.93 KB
/
Copy pathDockerfile.pqc
File metadata and controls
59 lines (47 loc) · 1.93 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
57
58
59
FROM python:3.12.8-slim-bookworm
ARG LIBOQS_REF=0.12.0
ARG LIBOQS_PYTHON_REF=0.12.0
LABEL maintainer="Dr. Chokri NOUAR"
LABEL project="Hybrid-PKI-Lab"
LABEL description="Pinned real-PQC environment for the educational lab"
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1 \
APP_HOME=/app \
OQS_INSTALL_PATH=/usr/local \
LD_LIBRARY_PATH=/usr/local/lib \
HYBRID_PKI_DISABLE_OQS=0
WORKDIR ${APP_HOME}
RUN apt-get update && apt-get install -y --no-install-recommends \
git cmake ninja-build build-essential pkg-config libssl-dev ca-certificates python3-dev \
&& rm -rf /var/lib/apt/lists/*
RUN git clone --depth 1 --branch "${LIBOQS_REF}" \
https://github.com/open-quantum-safe/liboqs.git /tmp/liboqs \
&& cmake -S /tmp/liboqs -B /tmp/liboqs/build -GNinja \
-DCMAKE_INSTALL_PREFIX=/usr/local \
-DBUILD_SHARED_LIBS=ON \
-DOQS_BUILD_ONLY_LIB=ON \
-DOQS_USE_OPENSSL=ON \
&& cmake --build /tmp/liboqs/build --parallel 2 \
&& cmake --install /tmp/liboqs/build \
&& ldconfig \
&& rm -rf /tmp/liboqs
COPY requirements.txt pyproject.toml README.md ./
RUN python -m pip install --upgrade pip setuptools wheel \
&& pip install -r requirements.txt \
&& pip install "git+https://github.com/open-quantum-safe/liboqs-python.git@${LIBOQS_PYTHON_REF}"
COPY src ./src
COPY tests ./tests
COPY benchmarks ./benchmarks
COPY examples ./examples
COPY docs ./docs
COPY scripts ./scripts
RUN pip install .
RUN groupadd --system hybridpki \
&& useradd --system --gid hybridpki --home-dir /app hybridpki \
&& mkdir -p certs/root certs/intermediate certs/issued certs/revoked certs/hybrid benchmarks/results logs \
&& chown -R hybridpki:hybridpki /app \
&& python -c "import oqs; print('Pinned liboqs-python loaded successfully')"
USER hybridpki
EXPOSE 8000
CMD ["python", "-m", "uvicorn", "hybrid_pki.api.main:app", "--host", "0.0.0.0", "--port", "8000"]