Skip to content

Commit

Permalink
Update Dockerdile, allow to change python version & apline version & …
Browse files Browse the repository at this point in the history
…fix build error
  • Loading branch information
esola-thomas committed Feb 10, 2025
1 parent 1a29e93 commit 1bd1738
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 1bd1738

Please sign in to comment.