Skip to content

Commit

Permalink
Merge pull request ckan#5928 from kowh-ai/Docker-using-Python3
Browse files Browse the repository at this point in the history
Docker using python3
  • Loading branch information
Zharktas authored and frafra committed Jan 9, 2022
1 parent da2da8e commit d9a49a8
Showing 1 changed file with 25 additions and 13 deletions.
38 changes: 25 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,27 @@
# See CKAN docs on installation from Docker Compose on usage
FROM debian:stretch
FROM ubuntu:focal-20210119
MAINTAINER Open Knowledge

# Set timezone
ENV TZ=UTC
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

# Setting the locale
ENV LC_ALL=en_US.UTF-8
RUN apt-get update
RUN apt-get install --no-install-recommends -y locales
RUN sed -i "/$LC_ALL/s/^# //g" /etc/locale.gen
RUN dpkg-reconfigure --frontend=noninteractive locales
RUN update-locale LANG=${LC_ALL}

# Install required system packages
RUN apt-get -q -y update \
&& DEBIAN_FRONTEND=noninteractive apt-get -q -y upgrade \
&& apt-get -q -y install \
python-dev \
python-pip \
python-virtualenv \
python-wheel \
python3.6 \
python3-dev \
python3-pip \
python3-virtualenv \
python3-venv \
python3-wheel \
libpq-dev \
libxml2-dev \
Expand All @@ -25,6 +34,7 @@ RUN apt-get -q -y update \
git-core \
vim \
wget \
curl \
&& apt-get -q clean \
&& rm -rf /var/lib/apt/lists/*

Expand All @@ -42,17 +52,19 @@ RUN useradd -r -u 900 -m -c "ckan account" -d $CKAN_HOME -s /bin/false ckan

# Setup virtual environment for CKAN
RUN mkdir -p $CKAN_VENV $CKAN_CONFIG $CKAN_STORAGE_PATH && \
virtualenv $CKAN_VENV && \
ln -s $CKAN_VENV/bin/pip /usr/local/bin/ckan-pip &&\
ln -s $CKAN_VENV/bin/paster /usr/local/bin/ckan-paster &&\
python3 -m venv $CKAN_VENV && \
ln -s $CKAN_VENV/bin/pip3 /usr/local/bin/ckan-pip3 &&\
ln -s $CKAN_VENV/bin/ckan /usr/local/bin/ckan

# Virtual environment binaries/scripts to be used first
ENV PATH=${CKAN_VENV}/bin:${PATH}

# Setup CKAN
ADD . $CKAN_VENV/src/ckan/
RUN ckan-pip install -U pip && \
ckan-pip install --upgrade --no-cache-dir -r $CKAN_VENV/src/ckan/requirement-setuptools.txt && \
ckan-pip install --upgrade --no-cache-dir -r $CKAN_VENV/src/ckan/requirements-py2.txt && \
ckan-pip install -e $CKAN_VENV/src/ckan/ && \
RUN ckan-pip3 install -U pip && \
ckan-pip3 install --upgrade --no-cache-dir -r $CKAN_VENV/src/ckan/requirement-setuptools.txt && \
ckan-pip3 install --upgrade --no-cache-dir -r $CKAN_VENV/src/ckan/requirements.txt && \
ckan-pip3 install -e $CKAN_VENV/src/ckan/ && \
ln -s $CKAN_VENV/src/ckan/ckan/config/who.ini $CKAN_CONFIG/who.ini && \
cp -v $CKAN_VENV/src/ckan/contrib/docker/ckan-entrypoint.sh /ckan-entrypoint.sh && \
chmod +x /ckan-entrypoint.sh && \
Expand Down

0 comments on commit d9a49a8

Please sign in to comment.