-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update Dockerfile for new ckanext-grouphierarchy
- Loading branch information
Showing
2 changed files
with
67 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,81 @@ | ||
# ############################################################################### | ||
# # Build stage | ||
# ############################################################################### | ||
ARG CKAN_VERSION=2.9.7 | ||
|
||
FROM ghcr.io/keitaroinc/ckan:${CKAN_VERSION} as extbuild | ||
|
||
# ckanext-hierarchy ########################################################### | ||
ARG CKAN_EXT_HIERARCHY_VERSION=master | ||
ENV CKAN_EXT_HIERARCHY_VERSION=${CKAN_EXT_HIERARCHY_VERSION} | ||
|
||
USER root | ||
|
||
RUN set -ex && \ | ||
apk update && \ | ||
apk add --no-cache --virtual .build-deps \ | ||
python3-dev && \ | ||
pip install --upgrade pip \ | ||
pip install -r https://raw.githubusercontent.com/ckan/ckanext-hierarchy/${CKAN_EXT_HIERARCHY_VERSION}/dev-requirements.txt | ||
|
||
RUN set -ex && \ | ||
mkdir -p /wheels && \ | ||
pip wheel --wheel-dir=/wheels git+https://github.com/davidread/ckanext-hierarchy.git@${CKAN_EXT_HIERARCHY_VERSION}#egg=ckanext-hierarchy && \ | ||
pip wheel --wheel-dir=/wheels -r https://raw.githubusercontent.com/ckan/ckanext-hierarchy/${CKAN_EXT_HIERARCHY_VERSION}/requirements.txt && \ | ||
curl -o /wheels/ckanext-hierarchy.txt https://raw.githubusercontent.com/ckan/ckanext-hierarchy/${CKAN_EXT_HIERARCHY_VERSION}/requirements.txt && \ | ||
ls -lah /wheels | ||
|
||
# ckanext-hierarchy ########################################################### | ||
ARG CKAN_EXT_SDDI_VERSION="2.9-support" | ||
ENV CKAN_EXT_SDDI_VERSION=${CKAN_EXT_SDDI_VERSION} | ||
|
||
RUN set -ex && \ | ||
mkdir -p /wheels && \ | ||
pip wheel --wheel-dir=/wheels \ | ||
git+https://github.com/tum-gis/ckanext-grouphierarchy-sddi.git@${CKAN_EXT_SDDI_VERSION}#egg=ckanext-grouphierarchy && \ | ||
pip wheel --wheel-dir=/wheels -r \ | ||
https://raw.githubusercontent.com/tum-gis/ckanext-grouphierarchy-sddi/${CKAN_EXT_SDDI_VERSION}/requirements.txt && \ | ||
curl -o /wheels/ckanext-grouphierarchy.txt \ | ||
https://raw.githubusercontent.com/tum-gis/ckanext-grouphierarchy-sddi/${CKAN_EXT_SDDI_VERSION}/requirements.txt && \ | ||
ls -lah /wheels | ||
|
||
############################################################################### | ||
# Runtime stage | ||
############################################################################### | ||
ARG CKAN_VERSION=2.9.7 | ||
FROM ghcr.io/keitaroinc/ckan:${CKAN_VERSION} as runtime | ||
|
||
ENV CKAN__PLUGINS image_view text_view recline_view datastore datapusher envvars hierarchy_display hierarchy_form display_group | ||
|
||
USER root | ||
|
||
# Copy python wheels from build stage | ||
ARG CKAN_EXT_SDDI_VERSION="2.9-support" | ||
COPY --from=extbuild /wheels /srv/app/ext_wheels | ||
COPY --chown=ckan:ckan afterinit.d/ ${APP_DIR}/docker-afterinit.d/ | ||
ADD https://raw.githubusercontent.com/tum-gis/ckanext-grouphierarchy-sddi/${CKAN_EXT_SDDI_VERSION}/ckanext/grouphierarchy/init_data.json \ | ||
/usr/lib/python3.8/site-packages/ckanext/grouphierarchy/init_data.json | ||
|
||
# Install runtime dependencies | ||
RUN set -ex && \ | ||
pip install --no-cache-dir -U pip && \ | ||
pip install --no-cache-dir -U ckanapi | ||
|
||
# Copy webassets and init scripts | ||
COPY --chown=ckan:ckan afterinit.d/ ${APP_DIR}/docker-afterinit.d/ | ||
COPY --chown=ckan:ckan webassets/ ${DATA_DIR}/webassets/ | ||
# ckanext-hierarchy ########################################################### | ||
RUN set -ex && \ | ||
pip install --no-index --find-links=/srv/app/ext_wheels ckanext-hierarchy && \ | ||
pip install --no-index --find-links=/srv/app/ext_wheels -r /srv/app/ext_wheels/ckanext-hierarchy.txt | ||
|
||
# ckanext-hierarchy ########################################################### | ||
RUN set -ex && \ | ||
pip install --no-index --find-links=/srv/app/ext_wheels ckanext-grouphierarchy && \ | ||
pip install --no-index --find-links=/srv/app/ext_wheels -r /srv/app/ext_wheels/ckanext-grouphierarchy.txt | ||
|
||
RUN set -ex && \ | ||
ckan config-tool "${APP_DIR}/production.ini" "ckan.plugins = ${CKAN__PLUGINS}" && \ | ||
chown -R ckan:ckan /srv/app && \ | ||
chown -Rv ckan:ckan /usr/lib/python3.8/site-packages/ckanext/grouphierarchy/init_data.json && \ | ||
# Remove wheels | ||
rm -rf /srv/app/ext_wheels | ||
|
||
USER ckan |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
#!/usr/bin/env bash | ||
|
||
echo "Create SDDI categories, topics, groups, and organizations ..." | ||
envsubst < "$APP_DIR/docker-afterinit.d/groups.jsonl" > "$APP_DIR/docker-afterinit.d/groups_subst.jsonl" | ||
ckanapi batch -c "${APP_DIR}/production.ini" -I "$APP_DIR/docker-afterinit.d/groups_subst.jsonl" | ||
ckan -c "${APP_DIR}/production.ini" grouphierarchy init_data | ||
echo "Create SDDI categories, topics, groups, and organizations ...done!" |