From b0405a58a8aa517ffb7c5dc5b963a10b8aa63783 Mon Sep 17 00:00:00 2001 From: Kiril-Poposki1998 Date: Thu, 22 Aug 2024 10:06:03 +0200 Subject: [PATCH 1/2] Fixing issue with ubuntu image --- compose/2.11/docker-compose.yml | 4 +-- images/ckan/2.11/Dockerfile.focal | 57 ++++++++++++++++++------------- 2 files changed, 35 insertions(+), 26 deletions(-) diff --git a/compose/2.11/docker-compose.yml b/compose/2.11/docker-compose.yml index 18e9927..c7f08a4 100644 --- a/compose/2.11/docker-compose.yml +++ b/compose/2.11/docker-compose.yml @@ -7,9 +7,7 @@ volumes: services: ckan: container_name: ckan - build: - context: ../../images/ckan/2.11/ - dockerfile: Dockerfile + image: ghcr.io/keitaroinc/ckan:${CKAN_VERSION} networks: - frontend - backend diff --git a/images/ckan/2.11/Dockerfile.focal b/images/ckan/2.11/Dockerfile.focal index 83ffd5b..4537f6f 100644 --- a/images/ckan/2.11/Dockerfile.focal +++ b/images/ckan/2.11/Dockerfile.focal @@ -1,7 +1,7 @@ ################## ### Build CKAN ### ################## -FROM ubuntu:focal-20210827 as ckanbuild +FROM ubuntu:focal-20240530 as ckanbuild # Used by Github Actions to tag the image with ENV IMAGE_TAG=2.11.0-focal @@ -34,12 +34,15 @@ RUN update-locale LANG=${LC_ALL} RUN apt-get install --no-install-recommends -y \ apt-utils +# Add python repository +RUN apt-get install software-properties-common -y && add-apt-repository ppa:deadsnakes/ppa + # Packages to build CKAN requirements and plugins RUN apt-get install --no-install-recommends -y \ git \ curl \ ca-certificates \ - python3 \ + python3.12 \ libpq-dev \ linux-headers-generic \ gcc-10 \ @@ -51,26 +54,32 @@ RUN apt-get install --no-install-recommends -y \ patch \ libpcre3-dev \ libpcre3 \ - python3-dev \ + python3.12-dev \ libffi-dev \ libxml2-dev \ - libxslt-dev + libxslt-dev \ + make \ + build-essential \ + libssl-dev \ + zlib1g-dev \ + libbz2-dev libreadline-dev libsqlite3-dev \ + libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev # Use gcc 10 RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 --slave /usr/bin/g++ g++ /usr/bin/g++-10 --slave /usr/bin/gcov gcov /usr/bin/gcov-10 --slave /usr/bin/x86_64-linux-gnu-gcc x86_64-linux-gnu-gcc /usr/bin/x86_64-linux-gnu-gcc-10 # Link python to python3 -RUN ln -s /usr/bin/python3 /usr/bin/python +RUN ln -s /bin/python3.12 /bin/python # Create the src directory RUN mkdir -p ${SRC_DIR} # Install pip RUN curl -o ${SRC_DIR}/get-pip.py https://bootstrap.pypa.io/get-pip.py && \ - python ${SRC_DIR}/get-pip.py + python3.12 ${SRC_DIR}/get-pip.py # Downgrade setuptools so that CKAN requirements can be built -RUN pip install setuptools==44.1.0 +RUN pip install setuptools==73.0.1 # Fetch and build CKAN and requirements RUN pip install -e git+${GIT_URL}@${GIT_BRANCH}#egg=ckan @@ -81,12 +90,12 @@ COPY ./scripts/apply_ckan_patches.sh ${SRC_DIR}/apply_ckan_patches.sh RUN ${SRC_DIR}/apply_ckan_patches.sh RUN rm -rf /srv/app/src/ckan/.git RUN pip wheel --wheel-dir=/wheels -r ckan/requirements.txt -RUN pip wheel --wheel-dir=/wheels uWSGI==2.0.20 gevent==22.10.2 greenlet==2.0.2 +RUN pip wheel --wheel-dir=/wheels uWSGI==2.0.26 gevent==24.2.1 greenlet==3.0.3 ########################### ### Default-Extensions #### ########################### -FROM ubuntu:focal-20210827 as extbuild +FROM ubuntu:focal-20240530 as extbuild # Set src dirs ENV SRC_DIR=/srv/app/src @@ -99,26 +108,27 @@ ENV DEFAULT_EXTENSIONS envvars ENV ENVVARS_GIT_URL=https://github.com/okfn/ckanext-envvars ENV ENVVARS_GIT_BRANCH=v0.0.4 +# Add python repository +RUN RUN apt-get update && \ + apt-get install software-properties-common -y && add-apt-repository ppa:deadsnakes/ppa && \ apt-get install --no-install-recommends -y \ git \ curl \ ca-certificates \ - python3 \ - python3-dev + python3.12 \ + python3.12-dev -# Link python to python3 -RUN ln -s /usr/bin/python3 /usr/bin/python # Create the src directory RUN mkdir -p ${SRC_DIR} # Install pip RUN curl -o ${SRC_DIR}/get-pip.py https://bootstrap.pypa.io/get-pip.py && \ - python ${SRC_DIR}/get-pip.py + python3.12 ${SRC_DIR}/get-pip.py # Downgrade setuptools so that CKAN requirements can be built -RUN pip install setuptools==44.1.0 +RUN pip install setuptools==73.0.1 # Fetch and build the default CKAN extensions RUN pip wheel --wheel-dir=/wheels git+${ENVVARS_GIT_URL}@${ENVVARS_GIT_BRANCH}#egg=ckanext-envvars @@ -126,7 +136,7 @@ RUN pip wheel --wheel-dir=/wheels git+${ENVVARS_GIT_URL}@${ENVVARS_GIT_BRANCH}#e ############ ### MAIN ### ############ -FROM ubuntu:focal-20210827 +FROM ubuntu:focal-20240530 LABEL maintainer="Keitaro Inc " LABEL org.opencontainers.image.source https://github.com/keitaroinc/docker-ckan @@ -156,6 +166,7 @@ ENV CKAN__PLUGINS envvars activity image_view # Install necessary packages to run CKAN RUN apt-get update && \ + apt-get install software-properties-common -y && add-apt-repository ppa:deadsnakes/ppa && \ apt-get install --no-install-recommends -y \ gettext \ curl \ @@ -163,9 +174,9 @@ RUN apt-get update && \ libpq5 \ git \ postgresql-client \ - python3 \ + python3.12 \ python3-distutils \ - libpython3.8 \ + libpython3.12 \ libmagic1 \ libpcre3 \ libxslt1.1 \ @@ -176,14 +187,14 @@ RUN apt-get update && \ # Create SRC_DIR mkdir -p ${SRC_DIR} && \ # Link python to python3 - ln -s /usr/bin/python3 /usr/bin/python + ln -s /bin/python3.12 /bin/python # Install pip RUN curl -o ${SRC_DIR}/get-pip.py https://bootstrap.pypa.io/get-pip.py && \ - python ${SRC_DIR}/get-pip.py + python3.12 ${SRC_DIR}/get-pip.py # Downgrade setuptools so that CKAN requirements can be built -RUN pip install setuptools==44.1.0 +RUN pip install setuptools==73.0.1 # Get artifacts from build stages COPY --from=ckanbuild /wheels /srv/app/wheels @@ -191,7 +202,7 @@ COPY --from=extbuild /wheels /srv/app/ext_wheels COPY --from=ckanbuild /srv/app/src/ckan ${CKAN_DIR} # Additional install steps for build stages artifacts -RUN pip install --no-index --find-links=/srv/app/wheels uWSGI==2.0.20 gevent==22.10.2 +RUN pip install --no-index --find-links=/srv/app/wheels uWSGI==2.0.26 gevent==24.2.1 # Create a local user and group to run the app RUN groupadd -g 92 ckan && \ @@ -201,7 +212,7 @@ WORKDIR ${CKAN_DIR} # Install CKAN RUN pip install -e /srv/app/src/ckan && \ - cp who.ini ${APP_DIR} && \ + # cp who.ini ${APP_DIR} removed because it is not used anymore after 2.11 pip install --no-index --find-links=/srv/app/wheels -r requirements.txt && \ # Install default CKAN extensions pip install --no-index --find-links=/srv/app/ext_wheels ckanext-envvars && \ From ca2a024b3df5461bb25b7b3e6928428f92f24076 Mon Sep 17 00:00:00 2001 From: Kiril-Poposki1998 Date: Thu, 22 Aug 2024 10:52:37 +0200 Subject: [PATCH 2/2] Change symbolic link for python 3.12 --- images/ckan/2.11/Dockerfile.focal | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/images/ckan/2.11/Dockerfile.focal b/images/ckan/2.11/Dockerfile.focal index 4537f6f..fdd3cca 100644 --- a/images/ckan/2.11/Dockerfile.focal +++ b/images/ckan/2.11/Dockerfile.focal @@ -69,14 +69,16 @@ RUN apt-get install --no-install-recommends -y \ RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 --slave /usr/bin/g++ g++ /usr/bin/g++-10 --slave /usr/bin/gcov gcov /usr/bin/gcov-10 --slave /usr/bin/x86_64-linux-gnu-gcc x86_64-linux-gnu-gcc /usr/bin/x86_64-linux-gnu-gcc-10 # Link python to python3 -RUN ln -s /bin/python3.12 /bin/python +RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.12 312 && \ + update-alternatives --config python3 && \ + ln -s /usr/bin/python3 /usr/bin/python # Create the src directory RUN mkdir -p ${SRC_DIR} # Install pip RUN curl -o ${SRC_DIR}/get-pip.py https://bootstrap.pypa.io/get-pip.py && \ - python3.12 ${SRC_DIR}/get-pip.py + python ${SRC_DIR}/get-pip.py # Downgrade setuptools so that CKAN requirements can be built RUN pip install setuptools==73.0.1 @@ -119,13 +121,17 @@ RUN apt-get update && \ python3.12 \ python3.12-dev +# Link python to python3 +RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.12 312 && \ + update-alternatives --config python3 && \ + ln -s /usr/bin/python3 /usr/bin/python # Create the src directory RUN mkdir -p ${SRC_DIR} # Install pip RUN curl -o ${SRC_DIR}/get-pip.py https://bootstrap.pypa.io/get-pip.py && \ - python3.12 ${SRC_DIR}/get-pip.py + python ${SRC_DIR}/get-pip.py # Downgrade setuptools so that CKAN requirements can be built RUN pip install setuptools==73.0.1 @@ -185,13 +191,16 @@ RUN apt-get update && \ apache2-utils && \ rm -rf /var/lib/apt/lists/* && \ # Create SRC_DIR - mkdir -p ${SRC_DIR} && \ - # Link python to python3 - ln -s /bin/python3.12 /bin/python + mkdir -p ${SRC_DIR} + +# Link python to python3 +RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.12 312 && \ + update-alternatives --config python3 && \ + ln -s /usr/bin/python3 /usr/bin/python # Install pip RUN curl -o ${SRC_DIR}/get-pip.py https://bootstrap.pypa.io/get-pip.py && \ - python3.12 ${SRC_DIR}/get-pip.py + python ${SRC_DIR}/get-pip.py # Downgrade setuptools so that CKAN requirements can be built RUN pip install setuptools==73.0.1