This repository has been archived by the owner on Feb 13, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #181 from qld-gov-au/develop
Develop to master
- Loading branch information
Showing
19 changed files
with
365 additions
and
111 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
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
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
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,42 +1,46 @@ | ||
FROM amazeeio/python:2.7-ckan-21.6.0 | ||
|
||
ENV WORKDIR=/app | ||
|
||
ARG SITE_URL | ||
ENV SITE_URL="${SITE_URL}" | ||
ENV APP_DIR=/app/ckan/default | ||
ENV VENV_DIR=/app/ckan/default | ||
ENV APP_DIR=/app | ||
ENV CKAN_INI=/app/ckan/default/production.ini | ||
|
||
WORKDIR "${APP_DIR}" | ||
|
||
ENV DOCKERIZE_VERSION v0.6.1 | ||
RUN apk add --no-cache curl && curl -s -L -O https://github.com/jwilder/dockerize/releases/download/${DOCKERIZE_VERSION}/dockerize-alpine-linux-amd64-${DOCKERIZE_VERSION}.tar.gz \ | ||
RUN apk add --no-cache curl build-base \ | ||
&& curl -s -L -O https://github.com/jwilder/dockerize/releases/download/${DOCKERIZE_VERSION}/dockerize-alpine-linux-amd64-${DOCKERIZE_VERSION}.tar.gz \ | ||
&& tar -C /usr/local/bin -xzvf dockerize-alpine-linux-amd64-${DOCKERIZE_VERSION}.tar.gz \ | ||
&& rm dockerize-alpine-linux-amd64-${DOCKERIZE_VERSION}.tar.gz | ||
|
||
# Install CKAN. | ||
ENV CKAN_VERSION 2.8.8 | ||
RUN . ${APP_DIR}/bin/activate \ | ||
&& cd ${APP_DIR} \ | ||
|
||
RUN . ${VENV_DIR}/bin/activate \ | ||
&& pip install setuptools==36.1 \ | ||
&& pip install -e "git+https://github.com/ckan/ckan.git@ckan-${CKAN_VERSION}#egg=ckan" \ | ||
&& sed -i "s/psycopg2==2.4.5/psycopg2==2.7.7/g" "${APP_DIR}/src/ckan/requirements.txt" \ | ||
&& pip install -r "${APP_DIR}/src/ckan/requirements.txt" \ | ||
&& ln -s "${APP_DIR}/src/ckan/who.ini" "${APP_DIR}/who.ini" \ | ||
&& sed -i "s/psycopg2==2.4.5/psycopg2==2.7.7/g" "${VENV_DIR}/src/ckan/requirements.txt" \ | ||
&& pip install -r "${VENV_DIR}/src/ckan/requirements.txt" \ | ||
&& ln -s "${VENV_DIR}/src/ckan/who.ini" "${VENV_DIR}/who.ini" \ | ||
&& deactivate \ | ||
&& ln -s /app/ckan /usr/lib/ckan | ||
&& ln -s ${APP_DIR}/ckan /usr/lib/ckan \ | ||
&& fix-permissions ${APP_DIR}/ckan | ||
|
||
COPY .docker/test.ini /app/ckan/default/production.ini | ||
COPY .docker/test.ini $CKAN_INI | ||
|
||
COPY .docker/scripts /app/scripts | ||
# Add current extension and files. | ||
COPY . ${APP_DIR}/ | ||
|
||
RUN fix-permissions /app/ckan \ | ||
&& chmod +x /app/scripts/*.sh | ||
COPY .docker/scripts ${APP_DIR}/scripts | ||
|
||
# Add current extension and files. | ||
COPY ckanext /app/ckanext | ||
COPY requirements.txt requirements-dev.txt setup.cfg setup.py .flake8 /app/ | ||
COPY .docker/scripts/ckan_cli ${VENV_DIR}/bin/ | ||
|
||
RUN chmod +x ${APP_DIR}/scripts/*.sh\ | ||
&& chmod +x ${VENV_DIR}/bin/ckan_cli | ||
|
||
# Init current extension. | ||
RUN /app/scripts/init-ext.sh | ||
RUN ${APP_DIR}/scripts/init-ext.sh | ||
|
||
ENTRYPOINT ["/sbin/tini", "--", "/lagoon/entrypoints.sh"] | ||
CMD ["/app/scripts/serve.sh"] |
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 |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#!/bin/sh | ||
|
||
# Call either 'ckan' (from CKAN >= 2.9) or 'paster' (from CKAN <= 2.8) | ||
# with appropriate syntax, depending on what is present on the system. | ||
# This is intended to smooth the upgrade process from 2.8 to 2.9. | ||
# Eg: | ||
# ckan_cli jobs list | ||
# could become either: | ||
# paster --plugin=ckan jobs list -c /etc/ckan/default/production.ini | ||
# or: | ||
# ckan -c /etc/ckan/default/production.ini jobs list | ||
|
||
# This script is aware of the VIRTUAL_ENV environment variable, and will | ||
# attempt to respect it with similar behaviour to commands like 'pip'. | ||
# Eg placing this script in a virtualenv 'bin' directory will cause it | ||
# to call the 'ckan' or 'paster' command in that directory, while | ||
# placing this script elsewhere will cause it to rely on the VIRTUAL_ENV | ||
# variable, or if that is not set, the system PATH. | ||
|
||
# Since the positioning of the CKAN configuration file is central to the | ||
# differences between 'paster' and 'ckan', this script needs to be aware | ||
# of the config file location. It will use the CKAN_INI environment | ||
# variable if it exists, or default to /etc/ckan/default/production.ini. | ||
|
||
# If 'paster' is being used, the default plugin is 'ckan'. A different | ||
# plugin can be specified by setting the PASTER_PLUGIN environment | ||
# variable. This variable is irrelevant if using the 'ckan' command. | ||
|
||
CKAN_INI="${CKAN_INI:-/etc/ckan/default/production.ini}" | ||
PASTER_PLUGIN="${PASTER_PLUGIN:-ckan}" | ||
# First, look for a command alongside this file | ||
ENV_DIR=$(dirname "$0") | ||
if [ -f "$ENV_DIR/ckan" ]; then | ||
COMMAND=ckan | ||
elif [ -f "$ENV_DIR/paster" ]; then | ||
COMMAND=paster | ||
elif [ "$VIRTUAL_ENV" != "" ]; then | ||
# If command not found alongside this file, check the virtualenv | ||
ENV_DIR="$VIRTUAL_ENV/bin" | ||
if [ -f "$ENV_DIR/ckan" ]; then | ||
COMMAND=ckan | ||
elif [ -f "$ENV_DIR/paster" ]; then | ||
COMMAND=paster | ||
fi | ||
else | ||
# if no virtualenv is active, try the system path | ||
if (which ckan > /dev/null 2>&1); then | ||
ENV_DIR=$(dirname $(which ckan)) | ||
COMMAND=ckan | ||
elif (which paster > /dev/null 2>&1); then | ||
ENV_DIR=$(dirname $(which paster)) | ||
COMMAND=paster | ||
else | ||
echo "Unable to locate 'ckan' or 'paster' command" >&2 | ||
exit 1 | ||
fi | ||
fi | ||
|
||
if [ "$COMMAND" = "ckan" ]; then | ||
echo "Using 'ckan' command from $ENV_DIR with config ${CKAN_INI}..." >&2 | ||
exec $ENV_DIR/ckan -c ${CKAN_INI} "$@" | ||
elif [ "$COMMAND" = "paster" ]; then | ||
echo "Using 'paster' command from $ENV_DIR with config ${CKAN_INI}..." >&2 | ||
exec $ENV_DIR/paster --plugin=$PASTER_PLUGIN "$@" -c ${CKAN_INI} | ||
else | ||
echo "Unable to locate 'ckan' or 'paster' command in $ENV_DIR" >&2 | ||
exit 1 | ||
fi |
Oops, something went wrong.