-
Notifications
You must be signed in to change notification settings - Fork 21
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 #44 from ckan/build-master-brancb
Build images for CKAN master branch
- Loading branch information
Showing
13 changed files
with
660 additions
and
7 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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: Build and publish the master docker-ckan image | ||
on: | ||
schedule: | ||
- cron: '15 5 * * *' | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: Login to DockerHub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- name: Build ckan-base master | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: ckan-master/base | ||
file: ckan-master/base/Dockerfile | ||
push: true | ||
tags: | | ||
ckan/ckan-base:master | ||
- name: Build ckan-dev master | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: ckan-master/dev | ||
file: ckan-master/dev/Dockerfile | ||
push: true | ||
tags: | | ||
ckan/ckan-dev:master |
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 |
---|---|---|
@@ -0,0 +1,111 @@ | ||
FROM alpine:3.17 | ||
ARG CKAN_VERSION=master | ||
|
||
# Internals, you probably don't need to change these | ||
ENV TZ=UTC | ||
ENV APP_DIR=/srv/app | ||
ENV SRC_DIR=/srv/app/src | ||
ENV CKAN_INI=${APP_DIR}/ckan.ini | ||
ENV PIP_SRC=${SRC_DIR} | ||
ENV CKAN_STORAGE_PATH=/var/lib/ckan | ||
ENV GIT_URL=https://github.com/ckan/ckan.git | ||
# CKAN version to build | ||
ENV GIT_BRANCH=${CKAN_VERSION} | ||
# Customize these on the .env file if needed | ||
ENV CKAN_SITE_URL=http://localhost:5000 | ||
ENV CKAN__PLUGINS image_view text_view datatables_view datastore envvars | ||
|
||
# UWSGI options | ||
ENV UWSGI_HARAKIRI=50 | ||
|
||
WORKDIR ${APP_DIR} | ||
|
||
# Set up timezone | ||
RUN apk add --no-cache tzdata | ||
RUN echo ${TZ} > /etc/timezone | ||
# Make sure both files are not exactly the same | ||
RUN if ! [ /usr/share/zoneinfo/${TZ} -ef /etc/localtime ]; then \ | ||
cp /usr/share/zoneinfo/${TZ} /etc/localtime ;\ | ||
fi ; | ||
|
||
# Install necessary packages to run CKAN | ||
RUN apk add --no-cache git \ | ||
gettext \ | ||
postgresql-client \ | ||
python3 \ | ||
libxml2 \ | ||
libxslt \ | ||
musl-dev \ | ||
uwsgi \ | ||
uwsgi-http \ | ||
uwsgi-corerouter \ | ||
uwsgi-python \ | ||
py3-gevent \ | ||
uwsgi-gevent \ | ||
libmagic \ | ||
curl \ | ||
patch \ | ||
bash && \ | ||
# Packages to build CKAN requirements and plugins | ||
apk add --no-cache --virtual .build-deps \ | ||
postgresql-dev \ | ||
gcc \ | ||
make \ | ||
g++ \ | ||
autoconf \ | ||
automake \ | ||
libtool \ | ||
python3-dev \ | ||
libxml2-dev \ | ||
libxslt-dev \ | ||
linux-headers \ | ||
openssl-dev \ | ||
libffi-dev \ | ||
cargo && \ | ||
# 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 && \ | ||
python3 ${SRC_DIR}/get-pip.py && \ | ||
pip3 install supervisor && \ | ||
mkdir /etc/supervisord.d && \ | ||
rm -rf ${SRC_DIR}/get-pip.py | ||
|
||
COPY setup/supervisord.conf /etc | ||
|
||
# Install CKAN | ||
RUN pip3 install -e git+${GIT_URL}@${GIT_BRANCH}#egg=ckan && \ | ||
cd ${SRC_DIR}/ckan && \ | ||
cp who.ini ${APP_DIR} && \ | ||
# Workaround, can be removed when this is merged | ||
# https://github.com/ckan/ckan/pull/7936 | ||
sed -i 's/backports-zoneinfo==0.2.1//' requirements.txt && \ | ||
pip3 install --no-binary markdown -r requirements.txt && \ | ||
# Install CKAN envvars to support loading config from environment variables | ||
pip3 install -e git+https://github.com/okfn/ckanext-envvars.git#egg=ckanext-envvars && \ | ||
# Create and update CKAN config | ||
ckan generate config ${CKAN_INI} && \ | ||
ckan config-tool ${CKAN_INI} "SECRET_KEY = " && \ | ||
ckan config-tool ${CKAN_INI} "ckan.plugins = ${CKAN__PLUGINS}" | ||
|
||
# Create a local user and group to run the app | ||
RUN addgroup -g 92 -S ckan && \ | ||
adduser -u 92 -h /home/ckan -s /bin/bash -D -G ckan ckan | ||
|
||
# Create local storage folder | ||
RUN mkdir -p ${CKAN_STORAGE_PATH} && \ | ||
chown -R ckan:ckan ${CKAN_STORAGE_PATH} | ||
|
||
COPY setup/prerun.py ${APP_DIR} | ||
COPY setup/start_ckan.sh ${APP_DIR} | ||
ADD https://raw.githubusercontent.com/ckan/ckan/${GIT_BRANCH}/wsgi.py ${APP_DIR} | ||
RUN chmod 644 ${APP_DIR}/wsgi.py | ||
|
||
# Create entrypoint directory for children image scripts | ||
ONBUILD RUN mkdir /docker-entrypoint.d | ||
|
||
EXPOSE 5000 | ||
|
||
HEALTHCHECK --interval=60s --timeout=5s --retries=5 CMD curl --fail http://localhost:5000/api/3/action/status_show || exit CMD ["/srv/app/start_ckan.sh"] | ||
|
||
CMD ["/srv/app/start_ckan.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,14 @@ | ||
.PHONY: all help build build-all push | ||
SHELL := /bin/bash | ||
CKAN_VERSION=master | ||
TAG_NAME="ckan/ckan-base:$(CKAN_VERSION)" | ||
|
||
all: help | ||
help: | ||
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' | ||
|
||
build: ## Build a CKAN 2.x.x image , `make build` | ||
docker build --build-arg="CKAN_VERSION=$(CKAN_VERSION)" -t $(TAG_NAME) . | ||
|
||
push: ## Push a CKAN 2.x.x image to the DockerHub registry, `make push` | ||
docker push $(TAG_NAME) |
Oops, something went wrong.