Skip to content

Commit 328ca53

Browse files
authored
Update Dockerfile, allow to change python version & apline version & … (#107)
* Update Dockerdile, allow to change python version & apline version & fix build error Signed-off-by: Ernesto Sola-Thomas <[email protected]> * Add OQS_INSTALL_PATH and update LD_LIBRARY_PATH Signed-off-by: Ernesto Sola-Thomas <[email protected]> * Python is already installed Signed-off-by: Ernesto Sola-Thomas <[email protected]> --------- Signed-off-by: Ernesto Sola-Thomas <[email protected]>
1 parent 1a29e93 commit 328ca53

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

docker/Dockerfile

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -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
77
ARG 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
1115
ARG LIBOQS_BUILD_DEFINES
1216
ARG MAKE_DEFINES
1317

1418
LABEL version="2"
1519

16-
ENV DEBIAN_FRONTEND noninteractive
20+
ENV DEBIAN_FRONTEND=noninteractive
1721

1822
RUN 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:
2125
RUN 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
3842
RUN 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
4748
COPY --from=intermediate /usr/local /usr/local
@@ -50,7 +51,7 @@ COPY --from=intermediate /opt/liboqs-python /opt/liboqs-python
5051
ENV 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
5657
RUN addgroup -g 1000 -S oqs && adduser --uid 1000 -S oqs -G oqs
@@ -61,5 +62,6 @@ COPY minitest.py /home/oqs/minitest.py
6162
COPY --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/
6567
CMD ["python3", "minitest.py"]

0 commit comments

Comments
 (0)