2017-05-09 18:22:04 +02:00
|
|
|
FROM keitaro/base:0.2
|
2016-08-25 17:40:05 +02:00
|
|
|
|
2017-05-09 18:22:04 +02:00
|
|
|
MAINTAINER Keitaro Inc <info@keitaro.com>
|
2016-08-25 17:40:05 +02:00
|
|
|
|
|
|
|
ENV APP_DIR=/srv/app
|
2016-10-26 09:28:54 +02:00
|
|
|
ENV SRC_DIR=/srv/app/src
|
2017-04-06 11:25:21 +02:00
|
|
|
ENV PIP_SRC=${SRC_DIR}
|
2016-11-07 12:10:47 +01:00
|
|
|
ENV GIT_URL=https://github.com/ckan/ckan.git
|
2017-04-06 11:25:21 +02:00
|
|
|
ENV GIT_BRANCH=ckan-2.6.2
|
2016-08-25 23:04:32 +02:00
|
|
|
ENV CKAN_SITE_URL=http://localhost:5000
|
2016-08-25 17:40:05 +02:00
|
|
|
ENV CKAN__PLUGINS image_view text_view recline_view datastore datapusher envvars
|
|
|
|
|
|
|
|
WORKDIR ${APP_DIR}
|
|
|
|
|
2017-04-06 11:25:21 +02:00
|
|
|
#########################
|
|
|
|
### Base docker layer ###
|
|
|
|
#########################
|
2017-05-09 18:22:04 +02:00
|
|
|
# Create a local user and group to run the app
|
|
|
|
RUN addgroup -g 92 -S ckan && \
|
|
|
|
adduser -u 92 -h /srv/app -H -D -S -G ckan ckan
|
2016-08-25 17:40:05 +02:00
|
|
|
# Install necessary packages to run CKAN
|
|
|
|
RUN apk add --no-cache git \
|
2016-10-26 09:28:54 +02:00
|
|
|
gettext \
|
|
|
|
postgresql-client \
|
|
|
|
python \
|
2017-04-06 11:25:21 +02:00
|
|
|
apache2-utils && \
|
|
|
|
# Packages to build CKAN requirements and plugins
|
2016-08-25 22:05:30 +02:00
|
|
|
apk add --no-cache --virtual .build-deps \
|
2016-10-26 09:28:54 +02:00
|
|
|
postgresql-dev \
|
2017-05-09 18:22:04 +02:00
|
|
|
linux-headers \
|
2016-10-26 09:28:54 +02:00
|
|
|
gcc \
|
|
|
|
make \
|
|
|
|
g++ \
|
|
|
|
autoconf \
|
|
|
|
automake \
|
|
|
|
libtool \
|
|
|
|
musl-dev \
|
2017-05-09 18:22:04 +02:00
|
|
|
pcre-dev \
|
2016-10-26 09:28:54 +02:00
|
|
|
python-dev && \
|
2017-04-06 11:25:21 +02:00
|
|
|
# Create SRC_DIR
|
|
|
|
mkdir -p ${SRC_DIR} && \
|
2017-05-09 18:22:04 +02:00
|
|
|
# Install pip and uwsgi
|
2017-04-06 11:25:21 +02:00
|
|
|
curl -o ${SRC_DIR}/get-pip.py https://bootstrap.pypa.io/get-pip.py && \
|
|
|
|
python ${SRC_DIR}/get-pip.py && \
|
2017-05-09 18:22:04 +02:00
|
|
|
pip install --no-cache-dir uwsgi gevent && \
|
2017-04-06 11:25:21 +02:00
|
|
|
rm -rf ${SRC_DIR}/get-pip.py
|
|
|
|
|
|
|
|
############################
|
|
|
|
### libgeos docker layer ###
|
|
|
|
############################
|
|
|
|
# Build and install libgeos to support geospatial
|
|
|
|
RUN git clone -b 3.6.0 --depth=1 --single-branch https://git.osgeo.org/gogs/geos/geos.git ${SRC_DIR}/geos && \
|
2016-10-26 09:28:54 +02:00
|
|
|
cd ${SRC_DIR}/geos && \
|
|
|
|
./autogen.sh && \
|
2016-11-07 12:10:47 +01:00
|
|
|
./configure --prefix /usr && \
|
2016-10-26 09:28:54 +02:00
|
|
|
make -j2 && \
|
|
|
|
make install && \
|
2017-04-06 11:25:21 +02:00
|
|
|
rm -rf ${SRC_DIR}/geos
|
|
|
|
|
|
|
|
#########################
|
|
|
|
### CKAN docker layer ###
|
|
|
|
#########################
|
|
|
|
# Install CKAN
|
|
|
|
RUN pip install -e git+${GIT_URL}@${GIT_BRANCH}#egg=ckan && \
|
2016-10-26 09:28:54 +02:00
|
|
|
cd ${SRC_DIR}/ckan && \
|
2016-08-25 17:40:05 +02:00
|
|
|
cp who.ini ${APP_DIR} && \
|
2017-04-06 11:25:21 +02:00
|
|
|
pip install -r requirements.txt && \
|
|
|
|
# Install CKAN envvars to support loading config from environment variables
|
2017-05-09 18:22:04 +02:00
|
|
|
pip install -e git+https://github.com/okfn/ckanext-envvars.git@0.0.1#egg=ckanext-envvars && \
|
2016-08-25 22:05:30 +02:00
|
|
|
# Create and update CKAN config
|
|
|
|
paster --plugin=ckan make-config ckan ${APP_DIR}/production.ini && \
|
2017-05-09 18:22:04 +02:00
|
|
|
paster --plugin=ckan config-tool ${APP_DIR}/production.ini "ckan.plugins = ${CKAN__PLUGINS}" && \
|
|
|
|
# Change ownership to app user
|
|
|
|
chown -R ckan:ckan /srv/app && \
|
|
|
|
# Clear the .git directory
|
|
|
|
rm -rf /srv/app/src/ckan/.git
|
2016-08-25 17:40:05 +02:00
|
|
|
|
2017-05-09 18:22:04 +02:00
|
|
|
COPY setup/app ${APP_DIR}
|
2016-08-25 17:40:05 +02:00
|
|
|
|
2016-08-25 22:13:02 +02:00
|
|
|
EXPOSE 5000
|
2016-08-25 17:40:05 +02:00
|
|
|
|
2017-04-07 09:34:40 +02:00
|
|
|
HEALTHCHECK --interval=10s --timeout=5s --retries=5 CMD curl --fail http://localhost:5000/api/3/action/status_show || exit 1
|
|
|
|
|
2017-05-09 18:22:04 +02:00
|
|
|
USER ckan
|
|
|
|
|
2016-08-25 22:05:30 +02:00
|
|
|
CMD ["/srv/app/start_ckan.sh"]
|