From 98045d0bd999e53b6a0243a6a4c9e198ba0251d0 Mon Sep 17 00:00:00 2001 From: Thomas Cassaert Date: Tue, 24 Sep 2024 13:11:58 +0200 Subject: [PATCH] Improve Docker image build and do build image in pipeline Signed-off-by: Thomas Cassaert --- Dockerfile | 28 +++++----------------------- Jenkinsfile | 1 + 2 files changed, 6 insertions(+), 23 deletions(-) diff --git a/Dockerfile b/Dockerfile index d040b86..7508f42 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,4 @@ -FROM python:3.9-slim-bullseye - - -# Workaround for IPv4/IPv6 networking performance issues. -# (https://stackoverflow.com/questions/65760510/readtimeouterror-pip-not-installling-any-library) -RUN echo "precedence ::ffff:0:0/96 100" >> /etc/gai.conf +FROM python:3.11-slim-bookworm # Install OS updates (https://pythonspeed.com/articles/docker-cache-insecure-images/) @@ -34,23 +29,10 @@ USER openeo ENV VIRTUAL_ENV="/home/openeo/venv" RUN python3 -m venv $VIRTUAL_ENV ENV PATH="$VIRTUAL_ENV/bin:$PATH" +RUN pip install --upgrade pip +# Install openeo-aggregator +COPY --chown=openeo requirements.txt . +RUN pip install -r requirements.txt -# Copy source code -RUN mkdir /home/openeo/aggregator -WORKDIR /home/openeo/aggregator -COPY --chown=openeo setup.py setup.py -COPY --chown=openeo src src -COPY --chown=openeo conf conf -COPY --chown=openeo pytest.ini pytest.ini -COPY --chown=openeo tests tests -COPY --chown=openeo CHANGELOG.md CHANGELOG.md - - -# Install dependencies and app. -RUN pip install --upgrade pip && \ - pip install . - - -# TODO #117/#143 eliminate conf/gunicorn.prod.py reference CMD ["gunicorn", "--config=conf/gunicorn.prod.py", "openeo_aggregator.app:create_app()"] diff --git a/Jenkinsfile b/Jenkinsfile index e6483d5..bc401eb 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -2,6 +2,7 @@ @Library('lib')_ pythonPipeline { + build_container_image = true package_name = 'openeo-aggregator' test_module_name = 'openeo_aggregator' wipeout_workspace = true