Skip to content

Commit

Permalink
feat: bump dockerfile base image (#15)
Browse files Browse the repository at this point in the history
Bump dockerfile base image to 3.13-slim.
  • Loading branch information
Bodong-Yang authored Oct 17, 2024
1 parent 3a37af7 commit 32dbd2f
Showing 1 changed file with 16 additions and 20 deletions.
36 changes: 16 additions & 20 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,40 +1,37 @@
# ------ common build args ------ #
ARG PYTHON_VERSION=3.11.7
ARG PYTHON_BASE_VER=slim-bookworm
ARG PYTHON_VERSION=3.13
ARG PYTHON_BASE_VER=slim
ARG PYTHON_VENV=/venv

#
# ------ prepare venv ------ #
#
FROM python:${PYTHON_VERSION}-${PYTHON_BASE_VER} as venv_builder
FROM python:${PYTHON_VERSION}-${PYTHON_BASE_VER} AS venv_builder

ARG PYTHON_VENV

COPY ./src ./pyproject.toml /source_code
COPY ./src ./pyproject.toml /source_code/

# ------ install build deps ------ #
RUN set -eux; \
apt-get update ; \
apt-get install -y --no-install-recommends \
python3-dev \
gcc \
git \
libcurl4-openssl-dev \
libssl-dev \
gcc \
git

# ------ setup virtual env and build ------ #
RUN set -eux ; \
python3-dev; \
apt-get clean; \
# ------ setup virtual env and build ------ #
python3 -m venv ${PYTHON_VENV} ; \
. ${PYTHON_VENV}/bin/activate ; \
export PYTHONDONTWRITEBYTECODE=1 ; \
cd /source_code ;\
python3 -m pip install -U pip ; \
python3 -m pip install .

# ------ post installation, cleanup ------ #
# cleanup the python venv again
# see python-slim Dockerfile for more details
RUN set -eux ; \
python3 -m pip install . ;\
# ------ post installation, cleanup ------ #
# cleanup the python venv again
# see python-slim Dockerfile for more details
find ${PYTHON_VENV} -depth \
\( \
\( -type d -a \( -name test -o -name tests -o -name idle_test \) \) \
Expand All @@ -59,10 +56,9 @@ RUN set -eux ; \
rm -rf \
/var/lib/apt/lists/* \
/root/.cache \
/tmp/*

# add mount points placeholder
RUN mkdir -p /opt /greengrass
/tmp/* ;\
# add mount points placeholder
mkdir -p /opt /greengrass

ENV PATH="${PYTHON_VENV}/bin:${PATH}"

Expand Down

0 comments on commit 32dbd2f

Please sign in to comment.