diff --git a/images/keripy.dockerfile b/images/keripy.dockerfile index aa75fbbc3..6a155c28e 100644 --- a/images/keripy.dockerfile +++ b/images/keripy.dockerfile @@ -1,22 +1,50 @@ +# Builder layer +FROM python:3.10.13-alpine3.18 as builder -FROM python:3.10.4-alpine3.16 +# Install compilation dependencies +RUN apk --no-cache add \ + bash \ + alpine-sdk \ + libffi-dev \ + libsodium \ + libsodium-dev -RUN apk update -RUN apk add bash SHELL ["/bin/bash", "-c"] -RUN apk add alpine-sdk -RUN apk add libffi-dev -RUN apk add libsodium -RUN apk add libsodium-dev - # Setup Rust for blake3 dependency build RUN curl https://sh.rustup.rs -sSf | bash -s -- -y -COPY . /keripy WORKDIR /keripy -# Install KERIpy dependencies -# Must source the Cargo environment for the blake3 library to see the Rust intallation during requirements install -RUN source "$HOME/.cargo/env" && pip install -r requirements.txt +RUN python -m venv venv + +ENV PATH=/keripy/venv/bin:${PATH} + +RUN pip install --upgrade pip && \ + mkdir /keripy/src + +# Copy Python dependency files in +COPY requirements.txt setup.py . +# Set up Rust environment and install Python dependencies +# Must source the Cargo environment for the blake3 library to see +# the Rust intallation during requirements install +RUN . ${HOME}/.cargo/env && \ + pip install -r requirements.txt + +# Runtime layer +FROM python:3.10.13-alpine3.18 + +RUN apk --no-cache add \ + bash \ + alpine-sdk \ + libsodium-dev + +WORKDIR /keripy + +COPY --from=builder /keripy /keripy +COPY src/ src/ + +ENV PATH=/keripy/venv/bin:${PATH} + +ENTRYPOINT [ "kli" ]