Created
November 7, 2018 16:34
-
-
Save ll911/8b76c0b07095e8a5070a46bf02a02cf0 to your computer and use it in GitHub Desktop.
ckan-alpine-base-bc.yaml
This file contains hidden or 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
| apiVersion: image.openshift.io/v1 | |
| kind: ImageStream | |
| metadata: | |
| name: ckan-alpine-base | |
| spec: | |
| lookupPolicy: | |
| local: false | |
| tags: | |
| - annotations: null | |
| from: | |
| kind: DockerImage | |
| name: docker-registry.default.svc:5000/dbc-bcdc-tools/ckan-alpine-base | |
| generation: null | |
| importPolicy: {} | |
| name: latest | |
| referencePolicy: | |
| type: "" | |
| status: | |
| dockerImageRepository: "" | |
| --- | |
| apiVersion: build.openshift.io/v1 | |
| kind: BuildConfig | |
| metadata: | |
| labels: | |
| app: ckan-alpine-base | |
| name: ckan-alpine-base | |
| spec: | |
| failedBuildsHistoryLimit: 5 | |
| output: | |
| to: | |
| kind: ImageStreamTag | |
| name: ckan-alpine-base:latest | |
| source: | |
| dockerfile: |- | |
| FROM alpine:3.8 | |
| # Internals, you probably don't need to change these | |
| ENV APP_DIR=/app \ | |
| SRC_DIR=/app/src \ | |
| CKAN_INI=${APP_DIR}/conf/production.ini \ | |
| PIP_SRC=${SRC_DIR} \ | |
| CKAN_STORAGE_PATH=/var/lib/ckan \ | |
| GIT_URL='https://github.com/ckan/ckan.git' \ | |
| GIT_BRANCH=ckan-2.7.2 \ | |
| CKAN_SITE_URL='http://localhost:5000' \ | |
| CKAN__PLUGINS='image_view text_view recline_view datastore datapusher envvars' | |
| WORKDIR ${APP_DIR} | |
| # Install necessary packages to run CKAN | |
| RUN apk add --no-cache git \ | |
| gettext \ | |
| postgresql-client \ | |
| python \ | |
| apache2-utils \ | |
| libxml2 \ | |
| libxslt \ | |
| musl-dev \ | |
| uwsgi \ | |
| uwsgi-http \ | |
| uwsgi-corerouter \ | |
| uwsgi-python \ | |
| py2-gevent \ | |
| uwsgi-gevent \ | |
| libmagic \ | |
| curl && \ | |
| # Packages to build CKAN requirements and plugins | |
| apk add --no-cache --virtual .build-deps \ | |
| postgresql-dev \ | |
| gcc \ | |
| make \ | |
| g++ \ | |
| autoconf \ | |
| automake \ | |
| libtool \ | |
| python-dev \ | |
| libxml2-dev \ | |
| libxslt-dev \ | |
| linux-headers && \ | |
| # Create SRC_DIR | |
| mkdir -p ${SRC_DIR} && \ | |
| # Install pip, supervisord and uwsgi | |
| curl -o ${SRC_DIR}/get-pip.py https://bootstrap.pypa.io/get-pip.py && \ | |
| python ${SRC_DIR}/get-pip.py && \ | |
| #pip install supervisor && \ | |
| #mkdir /etc/supervisord.d && \ | |
| #pip wheel --wheel-dir=/wheels uwsgi gevent && \ | |
| rm -rf ${SRC_DIR}/get-pip.py | |
| RUN echo "@testing http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories && \ | |
| apk add --update --no-cache geos@testing geos-dev@testing py-geos@testing | |
| # Install CKAN | |
| RUN pip install -e git+${GIT_URL}@${GIT_BRANCH}#egg=ckan && \ | |
| cd ${SRC_DIR}/ckan && \ | |
| cp who.ini ${APP_DIR} && \ | |
| # Workaround to solve https://github.com/psycopg/psycopg2/issues/594 in Alpine 3.7 | |
| sed -i -e "s/psycopg2==2.4.5/psycopg2==2.7.3.2/g" requirements.txt && \ | |
| pip install --no-binary :all: -r requirements.txt && \ | |
| # Install CKAN envvars to support loading config from environment variables | |
| pip install -e git+https://github.com/okfn/ckanext-envvars.git#egg=ckanext-envvars && \ | |
| # Create and update CKAN config | |
| paster --plugin=ckan make-config ckan ${CKAN_INI} && \ | |
| paster --plugin=ckan config-tool ${CKAN_INI} "ckan.plugins = ${CKAN__PLUGINS}" && \ | |
| paster --plugin=ckan config-tool ${CKAN_INI} "ckan.site_url = ${CKAN__SITE_URL}" | |
| # Create a local user and group to run the app | |
| RUN addgroup -g 92 -S ckan && \ | |
| adduser -u 92 -h /app -H -D -S -G ckan ckan && \ | |
| chown ckan -R /app | |
| EXPOSE 5000 | |
| type: Dockerfile | |
| strategy: | |
| dockerStrategy: | |
| from: | |
| kind: DockerImage | |
| name: alpine:3.8 | |
| type: Docker | |
| successfulBuildsHistoryLimit: 5 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment