docker-ckan/examples/harvest/Dockerfile

59 lines
1.7 KiB
Docker
Raw Normal View History

2020-09-11 13:33:41 +02:00
###################
### Extensions ####
###################
FROM ghcr.io/keitaroinc/ckan:2.9.11 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.4
2020-09-11 13:33:41 +02:00
# Switch to the root user
USER root
# Install necessary packages to build extensions
RUN apk add --no-cache \
python3-dev \
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.11
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