To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.

Statistics Download as Zip
| Branch: | Tag: | Revision:

root / extra / soundsoftware / dockertest / Dockerfile @ 1575:42618fc5ab46

History | View | Annotate | Download (3.43 KB)

1

    
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
# We're based in the code webapp directory from here on
66

    
67
WORKDIR /var/www/code
68

    
69

    
70
# Set up database config etc
71

    
72
RUN cp extra/soundsoftware/dockertest/database.yml.interpolated config/database.yml
73

    
74

    
75
# Install Rails and dependencies (database.yml must be populated before this)
76

    
77
RUN gem install bundler
78
RUN bundle install
79

    
80

    
81
# Initialise Redmine token (bundler must be installed before this)
82

    
83
RUN bundle exec rake generate_secret_token
84

    
85

    
86
# Import Postgres database from postgres-dumpall file
87

    
88
RUN chown postgres postgres-dumpall
89
RUN /etc/init.d/postgresql start && sudo -u postgres psql -f postgres-dumpall postgres
90

    
91

    
92
# Install Perl auth module for Hg access
93

    
94
RUN mkdir -p /usr/local/lib/site_perl/Apache/Authn/
95
RUN cp extra/soundsoftware/SoundSoftware.pm /usr/local/lib/site_perl/Apache/Authn/
96

    
97

    
98
# Set up Apache config (todo: insert variables)
99

    
100
RUN rm -f /etc/apache2/sites-enabled/000-default.conf
101

    
102
RUN cp extra/soundsoftware/dockertest/passenger.conf /etc/apache2/mods-available/
103
RUN cp extra/soundsoftware/dockertest/passenger.load /etc/apache2/mods-available/
104
RUN cp extra/soundsoftware/dockertest/perl.conf      /etc/apache2/mods-available/
105

    
106
RUN ln -s ../mods-available/passenger.conf  /etc/apache2/mods-enabled/
107
RUN ln -s ../mods-available/passenger.load  /etc/apache2/mods-enabled/
108
RUN ln -s ../mods-available/perl.conf       /etc/apache2/mods-enabled/
109
RUN ln -s ../mods-available/expires.load    /etc/apache2/mods-enabled/
110
RUN ln -s ../mods-available/rewrite.load    /etc/apache2/mods-enabled/
111

    
112
RUN cp extra/soundsoftware/dockertest/code.conf.interpolated /etc/apache2/sites-available/code.conf
113
RUN ln -s ../sites-available/code.conf /etc/apache2/sites-enabled/10-code.conf
114

    
115
RUN apache2ctl configtest
116

    
117

    
118
# Start Postgres and foregrounded Apache
119

    
120
RUN echo "#!/bin/bash"                      > container-run.sh
121
RUN echo "/etc/init.d/postgresql start"    >> container-run.sh
122
RUN echo "apache2ctl -D FOREGROUND"        >> container-run.sh
123
RUN chmod +x container-run.sh
124

    
125
EXPOSE 80
126
CMD ./container-run.sh
127