Skip to content
Snippets Groups Projects
Commit 053fd36e authored by Hannes Feldt's avatar Hannes Feldt
Browse files

Add docker image build

parent 2d1ffc66
No related branches found
No related tags found
No related merge requests found
Pipeline #64250 failed
Pipeline: Python Package

#64251

    .tox
    build
    *.egg-info
    venv
    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
    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
    ......@@ -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
    ......
    ......@@ -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]
    ......
    [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
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Please register or to comment