Skip to content

Commit

Permalink
Merge pull request #135 from keitaroinc/new-release
Browse files Browse the repository at this point in the history
Fixing issue with ubuntu image
  • Loading branch information
KirilPoposki98 committed Aug 22, 2024
2 parents 67b1427 + ca2a024 commit 357f479
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 23 deletions.
4 changes: 1 addition & 3 deletions compose/2.11/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
60 changes: 40 additions & 20 deletions images/ckan/2.11/Dockerfile.focal
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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 \
Expand All @@ -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}
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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}
Expand All @@ -118,15 +134,15 @@ 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

############
### MAIN ###
############
FROM ubuntu:focal-20210827
FROM ubuntu:focal-20240530

LABEL maintainer="Keitaro Inc <[email protected]>"
LABEL org.opencontainers.image.source https://github.com/keitaroinc/docker-ckan
Expand Down Expand Up @@ -156,16 +172,17 @@ 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 \
ca-certificates \
libpq5 \
git \
postgresql-client \
python3 \
python3.12 \
python3-distutils \
libpython3.8 \
libpython3.12 \
libmagic1 \
libpcre3 \
libxslt1.1 \
Expand All @@ -174,24 +191,27 @@ 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
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
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 && \
Expand All @@ -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 && \
Expand Down

0 comments on commit 357f479

Please sign in to comment.