Skip to content

Commit 0c68e0a

Browse files
author
Franz Ebner
committed
add docker ARGs for multi-stage FROMs, remove .env.example as it's a duplicate
1 parent 3ca15bd commit 0c68e0a

2 files changed

Lines changed: 14 additions & 7 deletions

File tree

‎{{ cookiecutter.__package_name_kebab_case }}/.devcontainer/.env.example‎

Lines changed: 0 additions & 2 deletions
This file was deleted.

‎{{ cookiecutter.__package_name_kebab_case }}/Dockerfile‎

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
ARG FROM_IMAGE=python
2-
ARG PYTHON_VERSION={{cookiecutter.python_version}}
1+
#TODO: might be cool to have a fixed image, to assure reproducibility
2+
ARG FROM_IMAGE=python:{{cookiecutter.python_version}}
3+
ARG FROM_IMAGE_RUNTIME=build
4+
ARG FROM_IMAGE_DEV=build
35

4-
FROM $FROM_IMAGE:$PYTHON_VERSION AS build
6+
FROM $FROM_IMAGE AS build
57

68
ARG POETRY_VERSION=1.8.3
79
ENV DEBIAN_FRONTEND=noninteractive
@@ -23,6 +25,13 @@ ENV PATH="/root/.local/bin:${PATH}" \
2325
RUN pipx install poetry==${POETRY_VERSION} && pipx ensurepath
2426

2527
# Setup directory structure
28+
# https://github.com/GoogleContainerTools/kaniko/issues/1508
29+
# seems like remnant of an earlier kaniko implementation
30+
# delete, to circumvent any side-effects
31+
# can be removed after issue above is fixed
32+
RUN rm -rf /workspace
33+
34+
RUN mkdir /workspace
2635
WORKDIR /workspace
2736

2837
# Install dependencies (package itself is not installed)
@@ -35,15 +44,15 @@ RUN poetry install --without dev --all-extras --no-root && rm -rf $POETRY_CACHE_
3544

3645
###############################################################################
3746
# TODO: build from FROM_IMAGE (or a plain python img), and just copy from build (without pyenv, poetry)
38-
FROM build AS runtime
47+
FROM $FROM_IMAGE_RUNTIME AS runtime
3948

4049
# Copy the rest of the repository
4150
COPY . .
4251

4352
CMD ["bash"]
4453

4554
###############################################################################
46-
FROM build AS dev
55+
FROM $FROM_IMAGE_DEV AS dev
4756

4857
# Point python path to workspace
4958
ENV PYTHONPATH="${PYTHONPATH}:/workspace"

0 commit comments

Comments
 (0)