Skip to content

Commit eadb864

Browse files
committed
Separate and harden standard Docker image
1 parent fe9e407 commit eadb864

1 file changed

Lines changed: 16 additions & 23 deletions

File tree

Dockerfile

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,21 @@
1-
FROM python:3.11-slim
1+
FROM python:3.12.8-slim-bookworm
22

3-
LABEL maintainer="Chokri"
3+
LABEL maintainer="Dr. Chokri NOUAR"
44
LABEL project="Hybrid-PKI-Lab"
5+
LABEL security.profile="local-educational-lab"
56

6-
ENV PYTHONDONTWRITEBYTECODE=1
7-
ENV PYTHONUNBUFFERED=1
8-
ENV PIP_NO_CACHE_DIR=1
9-
ENV APP_HOME=/app
7+
ENV PYTHONDONTWRITEBYTECODE=1 \
8+
PYTHONUNBUFFERED=1 \
9+
PIP_NO_CACHE_DIR=1 \
10+
APP_HOME=/app \
11+
HYBRID_PKI_DISABLE_OQS=1
1012

1113
WORKDIR ${APP_HOME}
1214

13-
RUN apt-get update && apt-get install -y --no-install-recommends \
14-
git cmake ninja-build build-essential pkg-config libssl-dev ca-certificates curl python3-dev \
15-
&& rm -rf /var/lib/apt/lists/*
16-
17-
RUN git clone --depth 1 https://github.com/open-quantum-safe/liboqs.git /tmp/liboqs \
18-
&& cmake -S /tmp/liboqs -B /tmp/liboqs/build -GNinja \
19-
-DCMAKE_INSTALL_PREFIX=/usr/local -DOQS_BUILD_ONLY_LIB=ON -DOQS_USE_OPENSSL=ON \
20-
&& cmake --build /tmp/liboqs/build \
21-
&& cmake --install /tmp/liboqs/build \
22-
&& rm -rf /tmp/liboqs
23-
24-
ENV LD_LIBRARY_PATH=/usr/local/lib:${LD_LIBRARY_PATH}
25-
2615
COPY requirements.txt pyproject.toml README.md ./
27-
RUN pip install --upgrade pip setuptools wheel \
16+
RUN python -m pip install --upgrade pip setuptools wheel \
2817
&& pip install -r requirements.txt \
29-
&& pip install liboqs-python || true
18+
&& pip install .
3019

3120
COPY src ./src
3221
COPY examples ./examples
@@ -35,8 +24,12 @@ COPY benchmarks ./benchmarks
3524
COPY docs ./docs
3625
COPY scripts ./scripts
3726

38-
RUN pip install -e .
39-
RUN mkdir -p certs/root certs/intermediate certs/issued certs/revoked certs/hybrid logs
27+
RUN groupadd --system hybridpki \
28+
&& useradd --system --gid hybridpki --home-dir /app hybridpki \
29+
&& mkdir -p certs/root certs/intermediate certs/issued certs/revoked certs/hybrid logs benchmarks/results \
30+
&& chown -R hybridpki:hybridpki /app
31+
32+
USER hybridpki
4033

4134
EXPOSE 8000
4235
CMD ["uvicorn", "hybrid_pki.api.main:app", "--host", "0.0.0.0", "--port", "8000"]

0 commit comments

Comments
 (0)