Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multistage dockerfile example #563

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 23 additions & 4 deletions images/keripy.dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

FROM python:3.10.4-alpine3.16
FROM python:3.10.4-alpine3.16 as builder

RUN apk update
RUN apk add bash
Expand All @@ -13,10 +13,29 @@ 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

RUN python -m venv venv

ENV PATH=/keripy/venv/bin:${PATH}

RUN pip install --upgrade pip

COPY requirements.txt setup.py .
COPY src/ src/
RUN . ${HOME}/.cargo/env && pip install -r requirements.txt

FROM python:3.10.4-alpine3.16

RUN apk add alpine-sdk
RUN apk add libsodium-dev

ENV PATH=/keripy/venv/bin:${PATH}

COPY --from=builder /keripy /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

ENTRYPOINT [ "kli" ]