docker-ckan/examples/harvest/Dockerfile

61 lines
1.9 KiB
Docker
Raw Normal View History

2020-09-11 13:33:41 +02:00
###################
### Extensions ####
###################
FROM ghcr.io/keitaroinc/ckan:2.9.4 as extbuild
2020-09-11 13:33:41 +02:00
# Locations and tags, please use specific tags or revisions
ENV HARVEST_GIT_URL=https://github.com/ckan/ckanext-harvest
ENV HARVEST_GIT_BRANCH=v1.3.1
# Switch to the root user
USER root
# Install necessary packages to build extensions
# Make sure we install python 3.8, cause CKAN is not compatible with 3.9
RUN apk add --no-cache --repository=http://dl-cdn.alpinelinux.org/alpine/v3.13/main \
python3-dev=3.8.10-r0 && \
apk add --no-cache \
2020-09-11 13:33:41 +02:00
gcc \
g++ \
libffi-dev \
openssl-dev \
rust \
cargo
2020-09-11 13:33:41 +02:00
# Fetch and build the custom CKAN extensions
RUN pip wheel --wheel-dir=/wheels git+${HARVEST_GIT_URL}@${HARVEST_GIT_BRANCH}#egg=ckanext-harvest
RUN pip wheel --wheel-dir=/wheels -r https://raw.githubusercontent.com/ckan/ckanext-harvest/${HARVEST_GIT_BRANCH}/pip-requirements.txt
RUN curl -o /wheels/harvest.txt https://raw.githubusercontent.com/ckan/ckanext-harvest/${HARVEST_GIT_BRANCH}/pip-requirements.txt
2021-01-15 22:24:16 +01:00
USER ckan
2020-09-11 13:33:41 +02:00
############
### MAIN ###
############
FROM ghcr.io/keitaroinc/ckan:2.9.4
2020-09-11 13:33:41 +02:00
2021-01-15 22:24:16 +01:00
LABEL maintainer="Keitaro Inc <info@keitaro.com>"
2020-09-11 13:33:41 +02:00
ENV CKAN__PLUGINS envvars image_view text_view recline_view datastore datapusher harvest ckan_harvester
# Switch to the root user
USER root
COPY --from=extbuild /wheels /srv/app/ext_wheels
# Install and enable the custom extensions
RUN pip install --no-index --find-links=/srv/app/ext_wheels ckanext-harvest && \
pip install --no-index --find-links=/srv/app/ext_wheels -r /srv/app/ext_wheels/harvest.txt && \
# Configure plugins
2021-01-15 22:24:16 +01:00
ckan config-tool "${APP_DIR}/production.ini" "ckan.plugins = ${CKAN__PLUGINS}" && \
2020-09-11 13:33:41 +02:00
chown -R ckan:ckan /srv/app
# Remove wheels
RUN rm -rf /srv/app/ext_wheels
2020-09-20 00:45:46 +02:00
# Add harvest afterinit script
COPY ./afterinit.d/00_harvest.sh ${APP_DIR}/docker-afterinit.d/00_harvest.sh
2020-09-11 13:33:41 +02:00
# Switch to the ckan user
USER ckan