forked from adamlaska/datatracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
185 lines (155 loc) · 5.2 KB
/
Dockerfile
File metadata and controls
185 lines (155 loc) · 5.2 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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
# -*- 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 dyne/devuan:beowulf
LABEL maintainer="Henrik Levkowetz <henrik@levkowetz.com>"
# Default django runserver port
EXPOSE 8000
# Run apt-get noninteractive
ENV DEBIAN_FRONTEND=noninteractive
ENV DEVUAN_FRONTEND=noninteractive
# Uncomment this to be able to install and run apt-show-versions:
RUN rm -v /etc/apt/apt.conf.d/docker-compress
RUN rm -v /var/lib/apt/lists/*lz4
RUN apt-get update --allow-releaseinfo-change
RUN apt-get install -qy apt-transport-https
# Use backports, updates, and security updates
RUN echo "deb http://deb.devuan.org/merged beowulf main contrib non-free" > /etc/apt/sources.list
RUN echo "deb http://deb.devuan.org/merged beowulf-security main contrib non-free" >> /etc/apt/sources.list
RUN echo "deb http://deb.devuan.org/merged beowulf-updates main contrib non-free" >> /etc/apt/sources.list
RUN echo "deb http://deb.devuan.org/merged beowulf-backports main contrib non-free" >> /etc/apt/sources.list
# Remove some excludes for the docker image
RUN sed -i -e '/^path-exclude=.*\/groff/d' \
-e '/^path-exclude=.*\/locale/d' \
-e '/^path-exclude=.*\/man/d' /etc/dpkg/dpkg.cfg.d/docker-excludes
# 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 \
build-essential \
bzip2 \
ca-certificates \
colordiff \
gawk \
gcc \
ipython \
jq \
less \
libbz2-dev \
libdb5.3-dev \
libexpat1-dev \
libffi-dev \
libgdbm-dev \
libjpeg62-turbo-dev \
liblzma-dev \
libmagic1 \
libmariadbclient-dev \
libncurses5-dev \
libncursesw5-dev \
libreadline-dev \
libsqlite3-dev \
libssl-dev \
libsvn1 \
libxml2-dev \
libxslt-dev \
libz-dev \
libffi-dev \
locales \
make \
man \
mariadb-client \
mariadb-server \
openssh-client \
patch \
procps \
pv \
rsync \
rsyslog \
subversion \
sudo \
uuid-dev \
vim \
wget \
xz-utils\
zile \
zlib1g-dev
# Postgresql packages
RUN apt-get install -qy \
postgresql-11 \
postgresql-server-dev-11
# 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_9.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 libyang1
# 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
# Remove an rsyslog module that we don't need, which also requires extra permissions
RUN sed -i -e '/load="imklog"/d' /etc/rsyslog.conf
# Set up root password
RUN echo "root:root" | chpasswd
# MySQL
VOLUME /var/lib/mysql
# idnits and dependencies
ADD https://tools.ietf.org/tools/idnits/idnits /usr/local/bin/
RUN chmod +rx /usr/local/bin/idnits
# Directory for Mac certs
RUN mkdir /etc/certificates
# # Python 3
# # Comment in if OS does not provide python3.6, which is the current
# # production version
ENV PYVER=3.6.10
ENV PYREV=3.6
WORKDIR /usr/src
RUN wget -q https://www.python.org/ftp/python/$PYVER/Python-$PYVER.tar.xz
RUN tar xJf Python-$PYVER.tar.xz
RUN rm Python-$PYVER.tar.xz
WORKDIR /usr/src/Python-$PYVER/
RUN ./configure
RUN make
RUN make altinstall
WORKDIR /usr/src
RUN rm -rf /usr/src/Python-$PYVER/
ENV HOSTNAME="datatracker"
ENV DDIR="/usr/local/share/datatracker"
RUN mkdir -p $DDIR
WORKDIR $DDIR
COPY requirements.txt ./
COPY setprompt ./
COPY docker-init.sh /docker-init.sh
RUN chmod +x /docker-init.sh
ENTRYPOINT ["/docker-init.sh"]
CMD /bin/bash