From 1bd17380f0be9591a9550f01f97c6dd6d9e6ada3 Mon Sep 17 00:00:00 2001 From: Ernesto Sola-Thomas Date: Sun, 9 Feb 2025 20:33:51 -0500 Subject: [PATCH] Update Dockerdile, allow to change python version & apline version & fix build error --- 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