To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.
root / deploy / docker / Dockerfile.inline @ 1590:c18460da6620
History | View | Annotate | Download (3.89 KB)
| 1 | 1587:d8949733849d | Chris | |
|---|---|---|---|
| 2 | # For documentation and experimental purposes only. As a |
||
| 3 | # reconstruction of the machine image that runs this application, |
||
| 4 | # there are lots of things missing here; but as a good Docker |
||
| 5 | # configuration, it fails by mixing together rather a lot of concerns. |
||
| 6 | |||
| 7 | FROM ubuntu:16.04 |
||
| 8 | MAINTAINER Chris Cannam <cannam@all-day-breakfast.com> |
||
| 9 | |||
| 10 | RUN apt-get update && \ |
||
| 11 | apt-get install -y \ |
||
| 12 | apache2 \ |
||
| 13 | apache2-dev \ |
||
| 14 | apt-utils \ |
||
| 15 | build-essential \ |
||
| 16 | cron \ |
||
| 17 | curl \ |
||
| 18 | doxygen \ |
||
| 19 | exim4 \ |
||
| 20 | git \ |
||
| 21 | graphviz \ |
||
| 22 | imagemagick \ |
||
| 23 | libapache-dbi-perl \ |
||
| 24 | libapache2-mod-perl2 \ |
||
| 25 | libapr1-dev \ |
||
| 26 | libaprutil1-dev \ |
||
| 27 | libauthen-simple-ldap-perl \ |
||
| 28 | libcurl4-openssl-dev \ |
||
| 29 | libdbd-pg-perl \ |
||
| 30 | libpq-dev \ |
||
| 31 | libmagickwand-dev \ |
||
| 32 | libio-socket-ssl-perl \ |
||
| 33 | logrotate \ |
||
| 34 | mercurial \ |
||
| 35 | postgresql \ |
||
| 36 | rsync \ |
||
| 37 | ruby \ |
||
| 38 | ruby-dev \ |
||
| 39 | sudo |
||
| 40 | |||
| 41 | # Also used on the live site, for javadoc extraction, but this is |
||
| 42 | # would be by far the biggest package here: let's omit it while we're |
||
| 43 | # not making use of it |
||
| 44 | # openjdk-9-jdk-headless |
||
| 45 | |||
| 46 | RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* |
||
| 47 | |||
| 48 | |||
| 49 | # Passenger gets installed through gem, not apt |
||
| 50 | |||
| 51 | RUN gem install passenger -v 4.0.60 --no-rdoc --no-ri |
||
| 52 | RUN passenger-install-apache2-module --languages=ruby |
||
| 53 | |||
| 54 | |||
| 55 | # Copy across webapp, set up ownership |
||
| 56 | |||
| 57 | COPY . /var/www/code |
||
| 58 | |||
| 59 | RUN groupadd code |
||
| 60 | RUN useradd -g code -G www-data code |
||
| 61 | RUN chown -R code.www-data /var/www/code |
||
| 62 | RUN find /var/www/code -type d -exec chmod g+s \{\} \;
|
||
| 63 | |||
| 64 | |||
| 65 | # Initialise /var/hg (in reality this would be mounted from somewhere) |
||
| 66 | |||
| 67 | RUN mkdir -p /var/hg |
||
| 68 | RUN chown code.www-data /var/hg |
||
| 69 | RUN chmod g+s /var/hg |
||
| 70 | COPY extra/soundsoftware/scripted-deploy/config/index.cgi /var/hg/ |
||
| 71 | COPY extra/soundsoftware/scripted-deploy/config/hgweb.config /var/hg/ |
||
| 72 | RUN chmod +x /var/hg/index.cgi |
||
| 73 | |||
| 74 | |||
| 75 | # We're based in the code webapp directory from here on |
||
| 76 | |||
| 77 | WORKDIR /var/www/code |
||
| 78 | |||
| 79 | |||
| 80 | # Set up database config etc |
||
| 81 | |||
| 82 | RUN cp extra/soundsoftware/scripted-deploy/config/database.yml.interpolated config/database.yml |
||
| 83 | |||
| 84 | |||
| 85 | # Install Rails and dependencies (database.yml must be populated before this) |
||
| 86 | |||
| 87 | RUN gem install bundler |
||
| 88 | RUN bundle install |
||
| 89 | |||
| 90 | |||
| 91 | # Initialise Redmine token (bundler must be installed before this) |
||
| 92 | |||
| 93 | RUN bundle exec rake generate_secret_token |
||
| 94 | |||
| 95 | |||
| 96 | # Import Postgres database from postgres-dumpall file |
||
| 97 | |||
| 98 | RUN chown postgres postgres-dumpall |
||
| 99 | RUN /etc/init.d/postgresql start && sudo -u postgres psql -f postgres-dumpall postgres |
||
| 100 | RUN rm postgres-dumpall |
||
| 101 | |||
| 102 | |||
| 103 | # Install Perl auth module for Hg access |
||
| 104 | |||
| 105 | RUN mkdir -p /usr/local/lib/site_perl/Apache/Authn/ |
||
| 106 | RUN cp extra/soundsoftware/SoundSoftware.pm /usr/local/lib/site_perl/Apache/Authn/ |
||
| 107 | |||
| 108 | |||
| 109 | # Set up Apache config (todo: insert variables) |
||
| 110 | |||
| 111 | RUN rm -f /etc/apache2/sites-enabled/000-default.conf |
||
| 112 | |||
| 113 | RUN cp extra/soundsoftware/scripted-deploy/config/passenger.conf /etc/apache2/mods-available/ |
||
| 114 | RUN cp extra/soundsoftware/scripted-deploy/config/passenger.load /etc/apache2/mods-available/ |
||
| 115 | RUN cp extra/soundsoftware/scripted-deploy/config/perl.conf /etc/apache2/mods-available/ |
||
| 116 | |||
| 117 | RUN ln -s ../mods-available/passenger.conf /etc/apache2/mods-enabled/ |
||
| 118 | RUN ln -s ../mods-available/passenger.load /etc/apache2/mods-enabled/ |
||
| 119 | RUN ln -s ../mods-available/perl.conf /etc/apache2/mods-enabled/ |
||
| 120 | RUN ln -s ../mods-available/expires.load /etc/apache2/mods-enabled/ |
||
| 121 | RUN ln -s ../mods-available/rewrite.load /etc/apache2/mods-enabled/ |
||
| 122 | RUN ln -s ../mods-available/cgi.load /etc/apache2/mods-enabled/ |
||
| 123 | |||
| 124 | RUN cp extra/soundsoftware/scripted-deploy/config/code.conf.interpolated /etc/apache2/sites-available/code.conf |
||
| 125 | RUN ln -s ../sites-available/code.conf /etc/apache2/sites-enabled/10-code.conf |
||
| 126 | |||
| 127 | RUN apache2ctl configtest |
||
| 128 | |||
| 129 | |||
| 130 | # Start Postgres and foregrounded Apache |
||
| 131 | |||
| 132 | RUN echo "#!/bin/bash" > container-run.sh |
||
| 133 | RUN echo "/etc/init.d/postgresql start" >> container-run.sh |
||
| 134 | RUN echo "apache2ctl -D FOREGROUND" >> container-run.sh |
||
| 135 | RUN chmod +x container-run.sh |
||
| 136 | |||
| 137 | EXPOSE 80 |
||
| 138 | CMD ./container-run.sh |