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

feat: bump dockerfile base image #15

Merged
merged 2 commits into from
Oct 17, 2024
Merged
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
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