Merge pull request #135 from keitaroinc/new-release

Fixing issue with ubuntu image
This commit is contained in:
KirilPoposki98 2024-08-22 11:17:25 +02:00 committed by GitHub
commit 357f479add
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 41 additions and 23 deletions

View File

@ -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

View File

@ -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,16 +54,24 @@ 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 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}
@ -70,7 +81,7 @@ RUN curl -o ${SRC_DIR}/get-pip.py https://bootstrap.pypa.io/get-pip.py && \
python ${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 +92,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,16 +110,21 @@ 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
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}
@ -118,7 +134,7 @@ RUN curl -o ${SRC_DIR}/get-pip.py https://bootstrap.pypa.io/get-pip.py && \
python ${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 +142,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 <info@keitaro.com>"
LABEL org.opencontainers.image.source https://github.com/keitaroinc/docker-ckan
@ -156,6 +172,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 +180,9 @@ RUN apt-get update && \
libpq5 \
git \
postgresql-client \
python3 \
python3.12 \
python3-distutils \
libpython3.8 \
libpython3.12 \
libmagic1 \
libpcre3 \
libxslt1.1 \
@ -174,8 +191,11 @@ RUN apt-get update && \
apache2-utils && \
rm -rf /var/lib/apt/lists/* && \
# Create SRC_DIR
mkdir -p ${SRC_DIR} && \
# Link python to python3
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
@ -183,7 +203,7 @@ RUN curl -o ${SRC_DIR}/get-pip.py https://bootstrap.pypa.io/get-pip.py && \
python ${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 +211,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 +221,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 && \