2015-03-07 16:03:14 +01:00
|
|
|
FROM phusion/baseimage:0.9.16
|
2014-10-26 22:21:58 +01:00
|
|
|
MAINTAINER Open Knowledge
|
|
|
|
|
|
|
|
# set UTF-8 locale
|
|
|
|
RUN locale-gen en_US.UTF-8 && \
|
|
|
|
echo 'LANG="en_US.UTF-8"' > /etc/default/locale
|
|
|
|
|
|
|
|
RUN apt-get -qq update
|
|
|
|
|
|
|
|
# Install required packages
|
|
|
|
RUN DEBIAN_FRONTEND=noninteractive apt-get -qq -y install \
|
|
|
|
python-minimal \
|
|
|
|
python-dev \
|
|
|
|
python-virtualenv \
|
|
|
|
libevent-dev \
|
|
|
|
libpq-dev \
|
2014-11-15 19:02:58 +01:00
|
|
|
libxml2-dev \
|
|
|
|
libxslt1-dev \
|
|
|
|
build-essential
|
|
|
|
|
|
|
|
# Install required packages
|
|
|
|
RUN DEBIAN_FRONTEND=noninteractive apt-get -qq -y install \
|
2014-10-26 22:21:58 +01:00
|
|
|
apache2 \
|
|
|
|
libapache2-mod-wsgi \
|
|
|
|
postfix \
|
|
|
|
git \
|
|
|
|
libgeos-c1 \
|
|
|
|
supervisor
|
|
|
|
|
2014-11-15 19:02:58 +01:00
|
|
|
ENV HOME /root
|
|
|
|
ENV CKAN_HOME /usr/lib/ckan/default
|
|
|
|
ENV CKAN_CONFIG /etc/ckan/default
|
|
|
|
ENV CONFIG_FILE ckan.ini
|
|
|
|
ENV CONFIG_OPTIONS custom_options.ini
|
|
|
|
ENV CKAN_DATA /var/lib/ckan
|
|
|
|
ENV CKAN_INI $CKAN_CONFIG/$CONFIG_FILE
|
|
|
|
|
2014-10-26 22:21:58 +01:00
|
|
|
# Create directories & virtual env for CKAN
|
|
|
|
RUN virtualenv $CKAN_HOME
|
|
|
|
RUN mkdir -p $CKAN_CONFIG $CKAN_DATA /var/log/ckan
|
|
|
|
RUN chown www-data:www-data $CKAN_DATA
|
|
|
|
|
2014-12-01 15:43:51 +01:00
|
|
|
# copy CKAN and any extensions in the source directory
|
2014-10-26 22:21:58 +01:00
|
|
|
ADD docker/ckan/pip_install_req.sh /usr/local/sbin/pip_install_req
|
|
|
|
|
2014-12-01 15:43:51 +01:00
|
|
|
# copy CKAN and any extensions in the source directory
|
2014-10-26 22:21:58 +01:00
|
|
|
ADD _src/ $CKAN_HOME/src/
|
|
|
|
ONBUILD ADD _src/ $CKAN_HOME/src/
|
2014-11-15 19:02:58 +01:00
|
|
|
RUN $CKAN_HOME/bin/pip install pip==1.4.1
|
2014-10-26 22:21:58 +01:00
|
|
|
# install what we've just copied
|
|
|
|
RUN pip_install_req
|
|
|
|
ONBUILD RUN pip_install_req
|
|
|
|
RUN ln -s $CKAN_HOME/src/ckan/ckan/config/who.ini $CKAN_CONFIG/who.ini
|
|
|
|
ONBUILD RUN ln -s $CKAN_HOME/src/ckan/ckan/config/who.ini $CKAN_CONFIG/who.ini
|
|
|
|
|
|
|
|
# Copy any custom config
|
|
|
|
COPY _etc/ckan/ $CKAN_CONFIG/
|
|
|
|
ONBUILD COPY _etc/ckan/ $CKAN_CONFIG/
|
|
|
|
|
|
|
|
# Make config file
|
|
|
|
RUN $CKAN_HOME/bin/paster make-config ckan ${CKAN_CONFIG}/${CONFIG_FILE}
|
|
|
|
|
|
|
|
# Configure apache
|
|
|
|
RUN a2dissite 000-default
|
2014-12-14 16:00:44 +01:00
|
|
|
RUN echo "Listen 80" > /etc/apache2/ports.conf
|
2014-10-26 22:21:58 +01:00
|
|
|
COPY _etc/apache2/apache.wsgi $CKAN_CONFIG/apache.wsgi
|
|
|
|
ONBUILD COPY _etc/apache2/apache.wsgi $CKAN_CONFIG/apache.wsgi
|
|
|
|
COPY _etc/apache2/apache.conf /etc/apache2/sites-available/ckan_default.conf
|
|
|
|
ONBUILD COPY _etc/apache2/apache.conf /etc/apache2/sites-available/ckan_default.conf
|
|
|
|
RUN a2ensite ckan_default
|
|
|
|
|
|
|
|
# Configure postfix
|
|
|
|
COPY _etc/postfix/main.cf /etc/postfix/main.cf
|
|
|
|
ONBUILD COPY _etc/postfix/main.cf /etc/postfix/main.cf
|
|
|
|
|
|
|
|
# Configure supervisor
|
|
|
|
COPY _etc/supervisor/conf.d/ /etc/supervisor/conf.d/
|
|
|
|
ONBUILD COPY _etc/supervisor/conf.d/ /etc/supervisor/conf.d/
|
|
|
|
|
|
|
|
# Configure cron
|
|
|
|
COPY _etc/cron.d/ /etc/cron.d/
|
2014-11-15 19:02:58 +01:00
|
|
|
RUN chmod 600 -R /etc/cron.d/
|
2014-10-26 22:21:58 +01:00
|
|
|
ONBUILD COPY _etc/cron.d/ /etc/cron.d/
|
2014-11-15 19:02:58 +01:00
|
|
|
ONBUILD RUN chmod 600 -R /etc/cron.d/
|
2014-10-26 22:21:58 +01:00
|
|
|
|
|
|
|
# Configure runit
|
|
|
|
ADD docker/ckan/my_init.d/ /etc/my_init.d/
|
|
|
|
ONBUILD COPY _etc/my_init.d/ /etc/my_init.d/
|
|
|
|
ADD docker/ckan/svc/ /etc/service/
|
|
|
|
|
|
|
|
CMD ["/sbin/my_init"]
|
|
|
|
|
2014-11-30 16:04:51 +01:00
|
|
|
VOLUME ["/usr/lib/ckan", "/var/lib/ckan", "/etc/ckan"]
|
2014-12-14 16:00:44 +01:00
|
|
|
EXPOSE 80
|
2014-10-26 22:21:58 +01:00
|
|
|
|
|
|
|
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
|
|
|
|
|
|
|
# Disable SSH
|
|
|
|
RUN rm -rf /etc/service/sshd /etc/my_init.d/00_regen_ssh_host_keys.sh
|