2014-05-04 19:14:46 +00:00
|
|
|
#--------- Generic stuff all our Dockerfiles should start with so we get caching ------------
|
|
|
|
FROM ubuntu:trusty
|
|
|
|
MAINTAINER Tim Sutton<tim@linfiniti.com>
|
|
|
|
|
|
|
|
RUN export DEBIAN_FRONTEND=noninteractive
|
|
|
|
ENV DEBIAN_FRONTEND noninteractive
|
|
|
|
RUN dpkg-divert --local --rename --add /sbin/initctl
|
|
|
|
#RUN ln -s /bin/true /sbin/initctl
|
|
|
|
|
|
|
|
# Use local cached debs from host (saves your bandwidth!)
|
|
|
|
# Change ip below to that of your apt-cacher-ng host
|
|
|
|
# Or comment this line out if you do not with to use caching
|
|
|
|
ADD 71-apt-cacher-ng /etc/apt/apt.conf.d/71-apt-cacher-ng
|
|
|
|
|
|
|
|
RUN echo "deb http://archive.ubuntu.com/ubuntu trusty main universe" > /etc/apt/sources.list
|
|
|
|
RUN apt-get -y update
|
|
|
|
# socat can be used to proxy an external port and make it look like it is local
|
2014-05-08 23:25:52 +00:00
|
|
|
RUN apt-get -y install ca-certificates socat openssh-server supervisor rpl pwgen
|
2014-05-04 19:14:46 +00:00
|
|
|
RUN mkdir /var/run/sshd
|
|
|
|
ADD sshd.conf /etc/supervisor/conf.d/sshd.conf
|
|
|
|
|
2014-05-08 23:25:52 +00:00
|
|
|
# Ubuntu 14.04 by default only allows non pwd based root login
|
|
|
|
# We disable that but also create an .ssh dir so you can copy
|
|
|
|
# up your key. NOTE: This is not a particularly robust setup
|
|
|
|
# security wise and we recommend to NOT expose ssh as a public
|
|
|
|
# service.
|
|
|
|
RUN rpl "PermitRootLogin without-password" "PermitRootLogin yes" /etc/ssh/sshd_config
|
|
|
|
RUN mkdir /root/.ssh
|
|
|
|
RUN chmod o-rwx /root/.ssh
|
2014-05-04 19:14:46 +00:00
|
|
|
|
|
|
|
#-------------Application Specific Stuff ----------------------------------------------------
|
|
|
|
|
|
|
|
# Next line a workaround for https://github.com/dotcloud/docker/issues/963
|
|
|
|
RUN apt-get install -y postgresql-9.3-postgis-2.1
|
|
|
|
RUN echo "host all all 0.0.0.0/0 md5" >> /etc/postgresql/9.3/main/pg_hba.conf
|
|
|
|
RUN service postgresql start && /bin/su postgres -c "createuser -d -s -r -l docker" && /bin/su postgres -c "psql postgres -c \"ALTER USER docker WITH ENCRYPTED PASSWORD 'docker'\"" && service postgresql stop
|
|
|
|
# Listen on all ip addresses
|
|
|
|
RUN echo "listen_addresses = '*'" >> /etc/postgresql/9.3/main/postgresql.conf
|
|
|
|
RUN echo "port = 5432" >> /etc/postgresql/9.3/main/postgresql.conf
|
|
|
|
|
|
|
|
# Start with supervisor
|
|
|
|
ADD postgres.conf /etc/supervisor/conf.d/postgres.conf
|
|
|
|
|
|
|
|
# Open port 5432 and 22 so linked containers can see them
|
|
|
|
EXPOSE 5432
|
|
|
|
EXPOSE 22
|
|
|
|
|
|
|
|
# Run any additional tasks here that are too tedious to put in
|
|
|
|
# this dockerfile directly.
|
|
|
|
ADD setup.sh /setup.sh
|
|
|
|
RUN chmod 0755 /setup.sh
|
|
|
|
RUN /setup.sh
|
|
|
|
|
|
|
|
# We will run any commands in this when the container starts
|
|
|
|
ADD start-postgis.sh /start-postgis.sh
|
|
|
|
RUN chmod 0755 /start-postgis.sh
|
|
|
|
|
2014-05-08 23:25:52 +00:00
|
|
|
# Called on first run of docker - will run supervisor
|
|
|
|
ADD start.sh /start.sh
|
|
|
|
RUN chmod 0755 /start.sh
|
|
|
|
|
|
|
|
CMD /start.sh
|