From 70b33b17bcc01f16b6392d312ec5fd3d7a54bfce Mon Sep 17 00:00:00 2001 From: Ernesto Sola-Thomas Date: Sun, 9 Feb 2025 20:33:51 -0500 Subject: [PATCH 1/3] Update Dockerdile, allow to change python version & apline version & fix build error Signed-off-by: Ernesto Sola-Thomas --- docker/Dockerfile | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 6772a78..115db8c 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -6,18 +6,22 @@ ARG LIBOQS_BUILD_DEFINES="-DOQS_DIST_BUILD=ON -DBUILD_SHARED_LIBS=ON -DOQS_USE_O # make build arguments: Adding -j here speeds up build but may tax hardware ARG MAKE_DEFINES="-j 2" -FROM alpine:3.16 as intermediate +# Define default versions for Python and Alpine +ARG PYTHON_VERSION=3.10.16 +ARG ALPINE_VERSION=3.20 + +FROM alpine:${ALPINE_VERSION} AS intermediate # Take in all global args ARG LIBOQS_BUILD_DEFINES ARG MAKE_DEFINES LABEL version="2" -ENV DEBIAN_FRONTEND noninteractive +ENV DEBIAN_FRONTEND=noninteractive RUN apk update && apk upgrade -# Get all software packages required for builing all components: +# Get all software packages required for building all components: RUN apk add build-base linux-headers cmake ninja git # get all sources @@ -38,7 +42,7 @@ RUN apk add automake autoconf && cd /opt/openssl && LDFLAGS="-Wl,-rpath -Wl,/usr RUN wget https://letsencrypt.org/certs/isrgrootx1.pem ## second stage: Only create minimal image without build tooling and intermediate build results generated above: -FROM alpine:3.16 +FROM python:${PYTHON_VERSION}-alpine${ALPINE_VERSION} # Get all software packages required for running all components: RUN apk update && apk upgrade && apk add python3 @@ -50,7 +54,7 @@ COPY --from=intermediate /opt/liboqs-python /opt/liboqs-python ENV PYTHONPATH=/opt/liboqs-python # Install liboqs-python -RUN cd /opt/liboqs-python && python3 setup.py install +RUN cd /opt/liboqs-python && pip install . # Enable a normal user RUN addgroup -g 1000 -S oqs && adduser --uid 1000 -S oqs -G oqs From 95f02e009d614f4b213719efd5d9a24c89067f67 Mon Sep 17 00:00:00 2001 From: Ernesto Sola-Thomas Date: Sun, 9 Feb 2025 21:05:51 -0500 Subject: [PATCH 2/3] Add OQS_INSTALL_PATH and update LD_LIBRARY_PATH Signed-off-by: Ernesto Sola-Thomas --- docker/Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 115db8c..34a4f64 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -65,5 +65,6 @@ COPY minitest.py /home/oqs/minitest.py COPY --from=intermediate /opt/isrgrootx1.pem /home/oqs/isrgrootx1.pem # ensure oqs libs are found. Unset if interested in using stock openssl: -ENV LD_LIBRARY_PATH=/usr/local/lib64 +ENV LD_LIBRARY_PATH=/usr/local/ +ENV OQS_INSTALL_PATH=/usr/local/ CMD ["python3", "minitest.py"] From 6a003b3c8fe7e299cd3d1086d51d0522370c824a Mon Sep 17 00:00:00 2001 From: Ernesto Sola-Thomas Date: Sun, 9 Feb 2025 21:31:17 -0500 Subject: [PATCH 3/3] Python is already installed Signed-off-by: Ernesto Sola-Thomas --- docker/Dockerfile | 3 --- 1 file changed, 3 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 34a4f64..cc7739f 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -44,9 +44,6 @@ RUN wget https://letsencrypt.org/certs/isrgrootx1.pem ## second stage: Only create minimal image without build tooling and intermediate build results generated above: FROM python:${PYTHON_VERSION}-alpine${ALPINE_VERSION} -# Get all software packages required for running all components: -RUN apk update && apk upgrade && apk add python3 - # Only retain the binary contents in the final image COPY --from=intermediate /usr/local /usr/local COPY --from=intermediate /opt/liboqs-python /opt/liboqs-python