From 9f433178a1122a27fdf7b0cace271e97047d26ef Mon Sep 17 00:00:00 2001 From: Kevin Griffin Date: Mon, 3 Jun 2024 07:25:41 -0400 Subject: [PATCH] updates dockerfile to new alpine (#792) * updates dockerfile to new alpine Signed-off-by: Kevin Griffin * updates dockerfile to new alpine Signed-off-by: Kevin Griffin --------- Signed-off-by: Kevin Griffin --- images/keripy.dockerfile | 41 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/images/keripy.dockerfile b/images/keripy.dockerfile index ca12837fc..3c2a5924b 100644 --- a/images/keripy.dockerfile +++ b/images/keripy.dockerfile @@ -1,18 +1,21 @@ -# Builder layer -FROM python:3.10-alpine as builder +ARG BASE=python:3.10.14-alpine3.20 -# Install compilation dependencies -RUN apk --no-cache add \ - bash \ +FROM ${BASE} as builder + +RUN apk add --no-cache bash + +SHELL ["/bin/bash", "-c"] + +RUN apk add --no-cache \ + curl \ + build-base \ alpine-sdk \ libffi-dev \ libsodium \ - libsodium-dev - -SHELL ["/bin/bash", "-c"] + libsodium-dev -# Setup Rust for blake3 dependency build -RUN curl https://sh.rustup.rs -sSf | bash -s -- -y +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y +ENV PATH="/root/.cargo/bin:${PATH}" WORKDIR /keripy @@ -20,19 +23,16 @@ RUN python -m venv venv ENV PATH=/keripy/venv/bin:${PATH} -RUN pip install --upgrade pip && \ - mkdir /keripy/src +RUN pip install --upgrade pip +RUN 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 + +RUN . ${HOME}/.cargo/env +RUN pip install -r requirements.txt # Runtime layer -FROM python:3.10.13-alpine3.18 +FROM ${BASE} RUN apk --no-cache add \ bash \ @@ -44,7 +44,6 @@ WORKDIR /keripy COPY --from=builder /keripy /keripy COPY src/ src/ -ENV PATH=/keripy/venv/bin:${PATH} - +ENV PATH="/keripy/venv/bin:${PATH}" ENTRYPOINT [ "kli" ]