Fixing issue with ubuntu image

This commit is contained in:
Kiril-Poposki1998 2024-08-22 10:06:03 +02:00
parent d445972f75
commit b0405a58a8
2 changed files with 35 additions and 26 deletions

View File

@ -7,9 +7,7 @@ volumes:
services: services:
ckan: ckan:
container_name: ckan container_name: ckan
build: image: ghcr.io/keitaroinc/ckan:${CKAN_VERSION}
context: ../../images/ckan/2.11/
dockerfile: Dockerfile
networks: networks:
- frontend - frontend
- backend - backend

View File

@ -1,7 +1,7 @@
################## ##################
### Build CKAN ### ### Build CKAN ###
################## ##################
FROM ubuntu:focal-20210827 as ckanbuild FROM ubuntu:focal-20240530 as ckanbuild
# Used by Github Actions to tag the image with # Used by Github Actions to tag the image with
ENV IMAGE_TAG=2.11.0-focal 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 \ RUN apt-get install --no-install-recommends -y \
apt-utils 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 # Packages to build CKAN requirements and plugins
RUN apt-get install --no-install-recommends -y \ RUN apt-get install --no-install-recommends -y \
git \ git \
curl \ curl \
ca-certificates \ ca-certificates \
python3 \ python3.12 \
libpq-dev \ libpq-dev \
linux-headers-generic \ linux-headers-generic \
gcc-10 \ gcc-10 \
@ -51,26 +54,32 @@ RUN apt-get install --no-install-recommends -y \
patch \ patch \
libpcre3-dev \ libpcre3-dev \
libpcre3 \ libpcre3 \
python3-dev \ python3.12-dev \
libffi-dev \ libffi-dev \
libxml2-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 # 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 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 # 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 # Create the src directory
RUN mkdir -p ${SRC_DIR} RUN mkdir -p ${SRC_DIR}
# Install pip # Install pip
RUN curl -o ${SRC_DIR}/get-pip.py https://bootstrap.pypa.io/get-pip.py && \ 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 # 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 # Fetch and build CKAN and requirements
RUN pip install -e git+${GIT_URL}@${GIT_BRANCH}#egg=ckan 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 ${SRC_DIR}/apply_ckan_patches.sh
RUN rm -rf /srv/app/src/ckan/.git RUN rm -rf /srv/app/src/ckan/.git
RUN pip wheel --wheel-dir=/wheels -r ckan/requirements.txt 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 #### ### Default-Extensions ####
########################### ###########################
FROM ubuntu:focal-20210827 as extbuild FROM ubuntu:focal-20240530 as extbuild
# Set src dirs # Set src dirs
ENV SRC_DIR=/srv/app/src 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_URL=https://github.com/okfn/ckanext-envvars
ENV ENVVARS_GIT_BRANCH=v0.0.4 ENV ENVVARS_GIT_BRANCH=v0.0.4
# Add python repository
RUN
RUN apt-get update && \ RUN apt-get update && \
apt-get install software-properties-common -y && add-apt-repository ppa:deadsnakes/ppa && \
apt-get install --no-install-recommends -y \ apt-get install --no-install-recommends -y \
git \ git \
curl \ curl \
ca-certificates \ ca-certificates \
python3 \ python3.12 \
python3-dev python3.12-dev
# Link python to python3
RUN ln -s /usr/bin/python3 /usr/bin/python
# Create the src directory # Create the src directory
RUN mkdir -p ${SRC_DIR} RUN mkdir -p ${SRC_DIR}
# Install pip # Install pip
RUN curl -o ${SRC_DIR}/get-pip.py https://bootstrap.pypa.io/get-pip.py && \ 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 # 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 # Fetch and build the default CKAN extensions
RUN pip wheel --wheel-dir=/wheels git+${ENVVARS_GIT_URL}@${ENVVARS_GIT_BRANCH}#egg=ckanext-envvars 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 ### ### MAIN ###
############ ############
FROM ubuntu:focal-20210827 FROM ubuntu:focal-20240530
LABEL maintainer="Keitaro Inc <info@keitaro.com>" LABEL maintainer="Keitaro Inc <info@keitaro.com>"
LABEL org.opencontainers.image.source https://github.com/keitaroinc/docker-ckan 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 # Install necessary packages to run CKAN
RUN apt-get update && \ RUN apt-get update && \
apt-get install software-properties-common -y && add-apt-repository ppa:deadsnakes/ppa && \
apt-get install --no-install-recommends -y \ apt-get install --no-install-recommends -y \
gettext \ gettext \
curl \ curl \
@ -163,9 +174,9 @@ RUN apt-get update && \
libpq5 \ libpq5 \
git \ git \
postgresql-client \ postgresql-client \
python3 \ python3.12 \
python3-distutils \ python3-distutils \
libpython3.8 \ libpython3.12 \
libmagic1 \ libmagic1 \
libpcre3 \ libpcre3 \
libxslt1.1 \ libxslt1.1 \
@ -176,14 +187,14 @@ RUN apt-get update && \
# Create SRC_DIR # Create SRC_DIR
mkdir -p ${SRC_DIR} && \ mkdir -p ${SRC_DIR} && \
# Link python to python3 # Link python to python3
ln -s /usr/bin/python3 /usr/bin/python ln -s /bin/python3.12 /bin/python
# Install pip # Install pip
RUN curl -o ${SRC_DIR}/get-pip.py https://bootstrap.pypa.io/get-pip.py && \ 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 # 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 # Get artifacts from build stages
COPY --from=ckanbuild /wheels /srv/app/wheels 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} COPY --from=ckanbuild /srv/app/src/ckan ${CKAN_DIR}
# Additional install steps for build stages artifacts # 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 # Create a local user and group to run the app
RUN groupadd -g 92 ckan && \ RUN groupadd -g 92 ckan && \
@ -201,7 +212,7 @@ WORKDIR ${CKAN_DIR}
# Install CKAN # Install CKAN
RUN pip install -e /srv/app/src/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 && \ pip install --no-index --find-links=/srv/app/wheels -r requirements.txt && \
# Install default CKAN extensions # Install default CKAN extensions
pip install --no-index --find-links=/srv/app/ext_wheels ckanext-envvars && \ pip install --no-index --find-links=/srv/app/ext_wheels ckanext-envvars && \