Skip to content

Instantly share code, notes, and snippets.

@evantill
Created June 29, 2017 08:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save evantill/9db4cfdfe26d114a52db022306361772 to your computer and use it in GitHub Desktop.
Save evantill/9db4cfdfe26d114a52db022306361772 to your computer and use it in GitHub Desktop.
dockerfile for koha installation
# Set the base image to Debian
FROM debian:jessie
LABEL maintainer "eric.vantillard@evaxion.fr"
ARG KOHA_LIBRARY_NAME
ARG MYSQL_ROOT_PASSWORD
ARG DROPBOX_OAUTH_ACCESS_TOKEN
#default koha conf parameters
ARG KOHA_DOMAIN
ARG KOHA_ZEBRA_LANGUAGE
ARG KOHA_ZEBRA_MARC_FORMAT
ARG INSTALL_LANGUAGES
ENV KOHA_LIBRARY_NAME $KOHA_LIBRARY_NAME
ENV INSTALL_LANGUAGES $INSTALL_LANGUAGES
ENV KOHA_DOMAIN $KOHA_DOMAIN
ENV REFRESHED_AT 2017-05-10
ENV HOME /root
WORKDIR /root
ENV PATH /usr/bin:/bin:/usr/sbin:/sbin
ENV DEBIAN_FRONTEND noninteractive
#install wget and curl
RUN apt-get update && \
apt-get -y install wget && \
apt-get -y install curl && \
apt-get clean
# Install Koha
RUN wget -q -O- http://debian.koha-community.org/koha/gpg.asc | apt-key add -
RUN echo 'deb http://debian.koha-community.org/koha stable main' | tee /etc/apt/sources.list.d/koha.list
RUN apt-get -y update && \
apt-get -y install koha-common && \
apt-get clean && \
/etc/init.d/koha-common stop
#Configure the defaults
COPY files/templates/etc/koha/koha-sites.conf.tmpl templates/
RUN envsubst < "templates/koha-sites.conf.tmpl" > "/etc/koha/koha-sites.conf"
#Setup apache
RUN a2dissite -q 000-default && \
(echo "ServerName localhost" > /etc/apache2/conf-available/fqdn.conf) && \
a2enconf -q fqdn && \
a2enmod -q rewrite && \
a2enmod -q cgi && \
service apache2 restart
#CONFIGURE mysql connection
COPY files/templates/etc/mysql/koha-common.cnf.tmpl templates/
RUN rm /etc/mysql/koha-common.cnf && \
envsubst < "templates/koha-common.cnf.tmpl" > "/etc/mysql/koha-common.cnf"
#init db on first run and start server
COPY files/docker-entrypoint.sh docker-entrypoint.sh
RUN chmod 700 docker-entrypoint.sh
#install and configure backup on dropbox
COPY files/dropbox_uploader.sh dropbox_uploader.sh
RUN chmod 700 dropbox_uploader.sh
COPY files/templates/home/dropbox_uploader.tmpl templates/
RUN envsubst < "templates/dropbox_uploader.tmpl" > "/root/.dropbox_uploader"
RUN chmod 600 /root/.dropbox_uploader
COPY files/etc/cron.d/koha-backup /etc/cron.d/koha-backup
RUN service cron start
ENTRYPOINT ["/root/docker-entrypoint.sh"]
EXPOSE 80
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment