diff --git a/CHANGELOG.md b/CHANGELOG.md index b157fba..aaad46d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,8 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] -### Added -- Placeholder for future updates and new features. +## [1.3.1] - 2026-05-04 + +### Changed +- Replaced `condaforge/mambaforge` base image with `mambaorg/micromamba:latest` in the conda Dockerfile for faster, smaller builds (closes #74) +- Removed `SHELL ["mamba", "run", ...]` workaround; environment activation is now handled via `MAMBA_DOCKERFILE_ACTIVATE=1` and `ENV_NAME`, which is the recommended micromamba pattern +- Improved Docker layer caching by copying `environment.yml` and creating the conda env before copying the full project source ## [1.3.0] - 2026-01-27 diff --git a/pyproject.toml b/pyproject.toml index cdfc728..78b9671 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "at-python-template" -version = "1.3.0" +version = "1.3.1" description = "This is the official Python Project Template of Alexander Thamm GmbH (AT)" authors = [ "Christian Baur ", diff --git a/{{cookiecutter.project_slug}}/Dockerfile__conda b/{{cookiecutter.project_slug}}/Dockerfile__conda index 9c04579..3b7ece3 100644 --- a/{{cookiecutter.project_slug}}/Dockerfile__conda +++ b/{{cookiecutter.project_slug}}/Dockerfile__conda @@ -1,20 +1,19 @@ -ARG IMAGE_TAG=24.7.1-2 - -FROM condaforge/mambaforge:${IMAGE_TAG} +FROM mambaorg/micromamba:latest LABEL maintainer="{{ cookiecutter.company_name if cookiecutter.company_name else cookiecutter.full_name }}" -WORKDIR /{{cookiecutter.module_name}} -COPY environment.yml . - -RUN conda config --set channel_priority strict && \ - mamba env create -n {{cookiecutter.module_name}}_env -f environment.yml +# Create env from spec before copying the full source for better layer caching +COPY --chown=$MAMBA_USER:$MAMBA_USER environment.yml /tmp/environment.yml +RUN micromamba env create -n {{cookiecutter.module_name}}_env -f /tmp/environment.yml && \ + micromamba clean --all --yes -# Make RUN commands use the new environment (see: https://pythonspeed.com/articles/activate-conda-dockerfile/) -SHELL ["mamba", "run", "-n", "{{cookiecutter.module_name}}_env", "/bin/bash", "-c"] +# Activate the named env for all subsequent RUN commands and the final CMD/ENTRYPOINT +# (see https://github.com/mamba-org/micromamba-docker#activating-the-environment) +ARG MAMBA_DOCKERFILE_ACTIVATE=1 +ENV ENV_NAME={{cookiecutter.module_name}}_env -COPY . . +WORKDIR /{{cookiecutter.module_name}} +COPY --chown=$MAMBA_USER:$MAMBA_USER . . RUN python setup.py install -# ENTRYPOINT doesn't use the same shell as RUN so you need the conda stuff -ENTRYPOINT ["mamba", "run", "-n", "{{cookiecutter.module_name}}_env", "python", "-OO", "-m", "{{ cookiecutter.module_name }}"] +ENTRYPOINT ["/usr/local/bin/_entrypoint.sh", "python", "-OO", "-m", "{{ cookiecutter.module_name }}"]