@@ -6,18 +6,22 @@ ARG LIBOQS_BUILD_DEFINES="-DOQS_DIST_BUILD=ON -DBUILD_SHARED_LIBS=ON -DOQS_USE_O
66# make build arguments: Adding -j here speeds up build but may tax hardware
77ARG MAKE_DEFINES="-j 2"
88
9- FROM alpine:3.16 as intermediate
9+ # Define default versions for Python and Alpine
10+ ARG PYTHON_VERSION=3.10.16
11+ ARG ALPINE_VERSION=3.20
12+
13+ FROM alpine:${ALPINE_VERSION} AS intermediate
1014# Take in all global args
1115ARG LIBOQS_BUILD_DEFINES
1216ARG MAKE_DEFINES
1317
1418LABEL version="2"
1519
16- ENV DEBIAN_FRONTEND noninteractive
20+ ENV DEBIAN_FRONTEND= noninteractive
1721
1822RUN apk update && apk upgrade
1923
20- # Get all software packages required for builing all components:
24+ # Get all software packages required for building all components:
2125RUN apk add build-base linux-headers cmake ninja git
2226
2327# get all sources
@@ -38,10 +42,7 @@ RUN apk add automake autoconf && cd /opt/openssl && LDFLAGS="-Wl,-rpath -Wl,/usr
3842RUN wget https://letsencrypt.org/certs/isrgrootx1.pem
3943
4044# # second stage: Only create minimal image without build tooling and intermediate build results generated above:
41- FROM alpine:3.16
42-
43- # Get all software packages required for running all components:
44- RUN apk update && apk upgrade && apk add python3
45+ FROM python:${PYTHON_VERSION}-alpine${ALPINE_VERSION}
4546
4647# Only retain the binary contents in the final image
4748COPY --from=intermediate /usr/local /usr/local
@@ -50,7 +51,7 @@ COPY --from=intermediate /opt/liboqs-python /opt/liboqs-python
5051ENV PYTHONPATH=/opt/liboqs-python
5152
5253# Install liboqs-python
53- RUN cd /opt/liboqs-python && python3 setup.py install
54+ RUN cd /opt/liboqs-python && pip install .
5455
5556# Enable a normal user
5657RUN addgroup -g 1000 -S oqs && adduser --uid 1000 -S oqs -G oqs
@@ -61,5 +62,6 @@ COPY minitest.py /home/oqs/minitest.py
6162COPY --from=intermediate /opt/isrgrootx1.pem /home/oqs/isrgrootx1.pem
6263
6364# ensure oqs libs are found. Unset if interested in using stock openssl:
64- ENV LD_LIBRARY_PATH=/usr/local/lib64
65+ ENV LD_LIBRARY_PATH=/usr/local/
66+ ENV OQS_INSTALL_PATH=/usr/local/
6567CMD ["python3" , "minitest.py" ]
0 commit comments