forked from adamlaska/datatracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
171 lines (140 loc) · 5.69 KB
/
Dockerfile
File metadata and controls
171 lines (140 loc) · 5.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
# -*- shell-mode -*-
# This file is a docker (https://www.docker.com/what-docker) recipe, which can be used to build
# a docker image which is ready to run a datatracker in development mode.
#
# It is used to build an image (once you've installed docker) using a command like this (assuming
# suitable replacement of $variables:
#
# $ docker build -t $yourdockerid/datatracker:$version
#
# To use a pre-built image, assuming we're on OS X and have a checked-out datatracker repository
# at /Users/$login/src/6.8.1.dev0, you would start (again assuming you've installed docker)
# a container from an image, as follows:
#
# $ docker run -ti --name=$containername -v /Users/$login:/home/$login levkowetz/datatracker:$version /bin/bash
#
# This maps your home directory to /home/$login in the container, and starts it running /bin/bash.
#
# In this first version, the docker environment is set up so that tests will run successfully,
# but the database has *not* been loaded with a dump, and supporting files (drafts, charters, etc.)
# have *not* been downloaded.
FROM debian:jessie
LABEL maintainer="Henrik Levkowetz <henrik@levkowetz.com>"
# Default django runserver port
EXPOSE 8000
# Run apt-get noninteractive
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update
RUN apt-get install -qy apt-transport-https
# Use backports, updates, and security updates; over https if possible
RUN echo "deb https://deb.debian.org/debian jessie main contrib non-free" > /etc/apt/sources.list
RUN echo "deb https://deb.debian.org/debian jessie-backports main contrib non-free" >> /etc/apt/sources.list
RUN echo "deb https://deb.debian.org/debian jessie-updates main contrib non-free" >> /etc/apt/sources.list
RUN echo "deb http://security.debian.org/debian-security jessie/updates main contrib non-free" >> /etc/apt/sources.list
# Install needed packages
#
# We're not including graphviz and ghostscript, needed for the 3 document
# dependency graph tests; they would increase the size of the image by about
# 15%, about 100MB.
# Fetch apt package information, and upgrade to latest package versions
RUN apt-get update
RUN apt-get -qy upgrade
# Install the packages we need
RUN apt-get install -qy \
bzip2 \
ca-certificates \
colordiff \
gawk \
gcc \
ipython \
less \
libfreetype6 \
libfontconfig \
libjpeg62-turbo-dev \
libsvn1 \
libxml2-dev \
libxslt-dev \
libz-dev \
locales \
man \
openssh-client \
patch \
procps \
pv \
python \
python-dev \
python-m2crypto \
python-subversion \
realpath \
rsync \
subversion \
sudo \
vim \
wget
# Install SystemV init
RUN apt-get install -qy sysvinit-core \
&& cp /usr/share/sysvinit/inittab /etc/inittab
# Get rid of systemd
RUN apt-get remove --yes --purge --auto-remove systemd \
&& echo -e "\nPackage: systemd\nPin: release *\nPin-Priority: -1\n" > /etc/apt/preferences.d/no-systemd
# ------------------------------------------------------------------------------
# The following section is all about installing mysql server 5.6, instead of
# 5.5 which is provided in jessie. It's a bit convoluted.
# ------------------------------------------------------------------------------
# Get the key used to sign the mysql repo
RUN gpg --keyserver pgp.mit.edu --recv-keys 5072E1F5
RUN gpg --export -a 5072E1F5 | apt-key add -
# Install a package which will install apt sources entries for current mysql
RUN echo 'mysql-apt-config mysql-apt-config/select-server select mysql-5.6' | debconf-set-selections
RUN echo 'mysql-apt-config mysql-apt-config/repo-url string https://repo.mysql.com/apt/' | debconf-set-selections
RUN echo "deb https://repo.mysql.com/apt/debian/ jessie mysql-apt-config" >> /etc/apt/sources.list.d/mysql-apt-config.list
RUN apt-get update
RUN apt-get install -qy mysql-apt-config
RUN rm /etc/apt/sources.list.d/mysql-apt-config.list
# Get the key used to sign the libyang repo
RUN wget -nv http://download.opensuse.org/repositories/home:liberouter/Debian_9.0/Release.key
RUN apt-key add - < Release.key
RUN rm Release.key
# Add apt source entry for libyang
RUN echo "deb http://download.opensuse.org/repositories/home:/liberouter/Debian_8.0/ /" >> /etc/apt/sources.list.d/libyang.list
# Update the package defs, and install the desired mysql from the mysql repo
RUN apt-get update
RUN apt-get install -qy mysql-community-server libmysqlclient-dev libyang
# This is expected to exist by the mysql startup scripts:
RUN touch /etc/mysql/debian.cnf
# ------------------------------------------------------------------------------
# Get rid of installation files we don't need in the image, to reduce size
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
# Enable some common locales
RUN sed -i -e 's/^. en_US/en_US/' -e 's/^. en_GB/en_GB/' -e 's/^. en_IE/en_IE/' /etc/locale.gen
RUN locale-gen
# Set up root password
RUN echo "root:root" | chpasswd
# MySQL
VOLUME /var/lib/mysql
# Pip
ENV PYTHONWARNINGS="ignore:a true SSLContext object,ignore:An HTTPS request has been made"
WORKDIR /usr/src
RUN wget -q https://bootstrap.pypa.io/get-pip.py && python get-pip.py && rm get-pip.py
RUN pip install certifi
RUN pip install virtualenv
# Phantomjs
WORKDIR /usr/local
RUN wget -qN https://tools.ietf.org/tar/phantomjs-1.9.8-linux-x86_64.tar.bz2
RUN tar xjf phantomjs-1.9.8-linux-x86_64.tar.bz2
WORKDIR /usr/local/bin
RUN ln -s /usr/local/phantomjs-1.9.8-linux-x86_64/bin/phantomjs .
# idnits and dependencies
ADD https://tools.ietf.org/tools/idnits/idnits /usr/local/bin/
RUN chmod +rx /usr/local/bin/idnits
ENV DDIR="/usr/local/share/datatracker"
RUN mkdir -p $DDIR
WORKDIR $DDIR
COPY requirements.txt ./
RUN pip --no-cache-dir install -r requirements.txt
COPY settings_local.py ./
COPY setprompt ./
COPY docker-init.sh /docker-init.sh
RUN chmod +x /docker-init.sh
ENTRYPOINT ["/docker-init.sh"]
CMD /bin/bash