diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000000000000000000000000000000000000..67114cc7b7ca0d1b907c02cdee71a1876deb470c --- /dev/null +++ b/.dockerignore @@ -0,0 +1,4 @@ +.tox +build +*.egg-info +venv diff --git a/docker/ci-runner/Dockerfile b/docker/ci-runner/Dockerfile index 937fe86ec3a04eb6d9bb1463b366168f23b32aec..7e9722a1fe540eed3366894b6bed53f24b514e3d 100644 --- a/docker/ci-runner/Dockerfile +++ b/docker/ci-runner/Dockerfile @@ -1,4 +1,4 @@ FROM python:3.11 RUN python -m pip install --upgrade pip -RUN pip install --upgrade cookiecutter tox twine +RUN python -m pip install --upgrade cookiecutter tox twine diff --git a/docker/package/Dockerfile b/docker/package/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..86c87acd1f2f087590cbccc7005a34fc7f000fdf --- /dev/null +++ b/docker/package/Dockerfile @@ -0,0 +1,18 @@ +ARG BUILD_ENV=no_copy + +FROM python:3.11 AS build_no_copy +ADD requirements.txt . +COPY . /work +RUN rm -r /work/dist | true +RUN python -m pip install --user tox +WORKDIR /work +RUN python -m tox -e build + +FROM python:3.11 AS build_copy +COPY dist /work/dist + +FROM build_${BUILD_ENV} AS build + +FROM python:3.11-slim +COPY --from=build /work/dist /dist +RUN python -m pip install /dist/*.whl diff --git a/{{cookiecutter.project_slug}}/.gitlab-ci.yml b/{{cookiecutter.project_slug}}/.gitlab-ci.yml index 49fdfb6779ba8c31379d05f9c45bbc09999db33c..45a5b3a93949c5018e6f89bfa8e8c3560f060ced 100644 --- a/{{cookiecutter.project_slug}}/.gitlab-ci.yml +++ b/{{cookiecutter.project_slug}}/.gitlab-ci.yml @@ -14,6 +14,7 @@ stages: # - build_extensions - test - package + - images - integration - publish # publish instead of deploy @@ -77,7 +78,7 @@ secret_detection: before_script: - python --version # For debugging - python -m pip install --upgrade pip - - pip install --upgrade tox twine + - python -m pip install --upgrade tox twine # Run all unit tests for Python versions except the base image run_unit_tests: @@ -88,7 +89,7 @@ run_unit_tests: - tox -e py3${PY_VERSION} parallel: matrix: # use the matrix for testing - - PY_VERSION: [7, 8, 9, 10] + - PY_VERSION: [8, 9, 10, 11, 12] # Run code coverage on the base image thus also performing unit tests run_unit_tests_coverage: @@ -122,6 +123,18 @@ package_docs: script: - tox -e docs +docker_build: + stage: images + image: docker:latest + needs: + - package_files + services: + - name: docker:dind + script: + - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY + - docker build . --build-arg BUILD_ENV=copy --tag $CI_REGISTRY_IMAGE/package_name:$CI_COMMIT_REF_SLUG + # - docker push $CI_REGISTRY_IMAGE/package_name:$CI_COMMIT_REF_SLUG + run_integration_tests: stage: integration allow_failure: true diff --git a/{{cookiecutter.project_slug}}/setup.cfg b/{{cookiecutter.project_slug}}/setup.cfg index 906b08ebcea3165b47b6663cf47f4894e43d0220..ac0ae10fd9566ad1f8cb48ca1c780dc3b5be040e 100644 --- a/{{cookiecutter.project_slug}}/setup.cfg +++ b/{{cookiecutter.project_slug}}/setup.cfg @@ -15,11 +15,11 @@ classifiers = Programming Language :: Python Programming Language :: Python :: 3 Programming Language :: Python :: 3 :: Only - Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.10 Programming Language :: Python :: 3.11 + Programming Language :: Python :: 3.12 Topic :: Internet :: WWW/HTTP Topic :: Internet :: WWW/HTTP :: Dynamic Content Topic :: Scientific/Engineering @@ -28,7 +28,7 @@ classifiers = [options] include_package_data = true packages = find: -python_requires = >=3.7 +python_requires = >=3.8 install_requires = file: requirements.txt [flake8] diff --git a/{{cookiecutter.project_slug}}/tox.ini b/{{cookiecutter.project_slug}}/tox.ini index a469b2d888fbfa5bd0d9ab18901b0cfca1f4296a..0801d567e29938015d759ebce32479f6ea932529 100644 --- a/{{cookiecutter.project_slug}}/tox.ini +++ b/{{cookiecutter.project_slug}}/tox.ini @@ -1,6 +1,6 @@ [tox] # Generative environment list to test all supported Python versions -envlist = py3{7,8,9,10},black,pep8,pylint +envlist = py3{8,9,10,11,12},black,pep8,pylint minversion = 3.18.0 [testenv] @@ -55,4 +55,5 @@ commands = [testenv:build] usedevelop = False +deps = build commands = {envpython} -m build