1- # -*- shell-mode -*-
2- # This file is a docker (https://www.docker.com/what-docker) recipe, which can be used to build
3- # a docker image which is ready to run a datatracker in development mode.
1+ # This is a Dockerfile with everything in it to run the IETF datatracker.
42#
5- # It is used to build an image (once you've installed docker) using a command like this (assuming
6- # suitable replacement of $variables:
3+ # If you make changes to the datatracker that add new dependencies (python
4+ # packages or otherwise), you need to rebuild this image to make them
5+ # available. Do this in the top-level directory of your datatracker source
6+ # tree:
77#
8- # $ docker build -t $yourdockerid/datatracker:$version
8+ # docker build --tag dt:latest .
99#
10- # To use a pre-built image, assuming we're on OS X and have a checked-out datatracker repository
11- # at /Users/$login/src/6.8.1.dev0, you would start (again assuming you've installed docker)
12- # a container from an image, as follows:
13- #
14- # $ docker run -ti --name=$containername -v /Users/$login:/home/$login levkowetz/datatracker:$version /bin/bash
15- #
16- # This maps your home directory to /home/$login in the container, and starts it running /bin/bash.
17- #
18- # In this first version, the docker environment is set up so that tests will run successfully,
19- # but the database has *not* been loaded with a dump, and supporting files (drafts, charters, etc.)
20- # have *not* been downloaded.
10+ # You can then execute the datatracker like this (also from the top-level
11+ # datatracker source directory):
12+ #
13+ # docker run -ti -v $(pwd):/root/src dt:latest
2114
22- FROM dyne/devuan:beowulf
23- LABEL maintainer="Henrik Levkowetz <henrik@levkowetz.com >"
15+ FROM ubuntu:hirsute
16+ LABEL maintainer="IETF Tools Team <tools-discuss@ietf.org >"
2417
2518# Default django runserver port
26- EXPOSE 8000
27-
28- # Run apt-get noninteractive
29- ENV DEBIAN_FRONTEND=noninteractive
30- ENV DEVUAN_FRONTEND=noninteractive
31-
32- # Uncomment this to be able to install and run apt-show-versions:
33- RUN rm -v /etc/apt/apt.conf.d/docker-compress
34- RUN rm -v /var/lib/apt/lists/*lz4
35-
36- RUN apt-get update --allow-releaseinfo-change
37- RUN apt-get install -qy apt-transport-https
38-
39- # Use backports, updates, and security updates
40- RUN echo "deb http://deb.devuan.org/merged beowulf main contrib non-free" > /etc/apt/sources.list
41- RUN echo "deb http://deb.devuan.org/merged beowulf-security main contrib non-free" >> /etc/apt/sources.list
42- RUN echo "deb http://deb.devuan.org/merged beowulf-updates main contrib non-free" >> /etc/apt/sources.list
43- RUN echo "deb http://deb.devuan.org/merged beowulf-backports main contrib non-free" >> /etc/apt/sources.list
19+ EXPOSE 8000
4420
45- # Remove some excludes for the docker image
46- RUN sed -i -e '/^path-exclude=.*\/ groff/d' \
47- -e '/^path-exclude=.*\/ locale/d' \
48- -e '/^path-exclude=.*\/ man/d' /etc/dpkg/dpkg.cfg.d/docker-excludes
21+ # Default mysqld/mariadb port
22+ EXPOSE 3306
4923
50- # Install needed packages
51- #
52- # We're not including graphviz and ghostscript, needed for the 3 document
53- # dependency graph tests; they would increase the size of the image by about
54- # 15%, about 100MB.
55-
56- # Fetch apt package information, and upgrade to latest package versions
57-
58- RUN apt-get update
59- RUN apt-get -qy upgrade
60-
61- # Install the packages we need
62- RUN apt-get install -qy \
63- build-essential \
64- bzip2 \
65- ca-certificates \
66- colordiff \
67- gawk \
68- gcc \
69- ipython \
70- jq \
71- less \
72- libbz2-dev \
73- libdb5.3-dev \
74- libexpat1-dev \
75- libffi-dev \
76- libgdbm-dev \
77- libjpeg62-turbo-dev \
78- liblzma-dev \
79- libmagic1 \
80- libmariadbclient-dev \
81- libncurses5-dev \
82- libncursesw5-dev \
83- libreadline-dev \
84- libsqlite3-dev \
85- libssl-dev \
86- libsvn1 \
87- libxml2-dev \
88- libxslt-dev \
89- libz-dev \
90- libffi-dev \
91- locales \
92- make \
93- man \
94- mariadb-client \
95- mariadb-server \
96- openssh-client \
97- patch \
98- procps \
99- pv \
100- rsync \
24+ # Install all dependencies that are available as packages
25+ ENV DEBIAN_FRONTEND=noninteractive
26+ RUN apt-get -y update && \
27+ apt-get -y install --no-install-recommends \
28+ apache2-utils \
29+ apt-file \
30+ apt-utils \
31+ chromium-driver \
32+ curl \
33+ enscript \
34+ gcc \
35+ ghostscript \
36+ git \
37+ graphviz \
38+ libmagic-dev \
39+ libmariadb-dev \
40+ mariadb-server \
41+ npm \
42+ pigz \
43+ pv \
44+ python-is-python3 \
45+ python3-dev \
46+ python3-pip \
10147 rsyslog \
102- subversion \
103- sudo \
104- uuid-dev \
105- vim \
106- wget \
107- xz-utils\
108- zile \
109- zlib1g-dev
48+ unzip \
49+ yang-tools && \
50+ apt-get -y clean && \
51+ rm -rf /var/lib/apt/lists/*
11052
111- # Postgresql packages
112- RUN apt-get install -qy \
113- postgresql-11 \
114- postgresql-server-dev-11
53+ # Install bower
54+ RUN npm install -g bower
11555
116- # Get the key used to sign the libyang repo
117- RUN wget -nv http://download.opensuse.org/repositories/home:liberouter/Debian_9.0/Release.key
118- RUN apt-key add - < Release.key
119- RUN rm Release.key
120-
121- # Add apt source entry for libyang
122- RUN echo "deb http://download.opensuse.org/repositories/home:/liberouter/Debian_9.0/ /" >> /etc/apt/sources.list.d/libyang.list
123-
124- # Update the package defs, and install the desired mysql from the mysql repo
125- RUN apt-get update
126- RUN apt-get install -qy libyang1
127-
128- # This is expected to exist by the mysql startup scripts:
129- # RUN touch /etc/mysql/debian.cnf
130- # ------------------------------------------------------------------------------
131-
132- # Get rid of installation files we don't need in the image, to reduce size
133- RUN apt-get clean && rm -rf /var/lib/apt/lists/*
134-
135- # Enable some common locales
136- RUN sed -i -e 's/^. en_US/en_US/' -e 's/^. en_GB/en_GB/' -e 's/^. en_IE/en_IE/' /etc/locale.gen
137- RUN locale-gen
138-
139- # Remove an rsyslog module that we don't need, which also requires extra permissions
140- RUN sed -i -e '/load="imklog"/d' /etc/rsyslog.conf
141-
142- # Set up root password
143- RUN echo "root:root" | chpasswd
144-
145- # MySQL
146- VOLUME /var/lib/mysql
147-
148- # idnits and dependencies
56+ # Install idnits
14957ADD https://tools.ietf.org/tools/idnits/idnits /usr/local/bin/
15058RUN chmod +rx /usr/local/bin/idnits
15159
152- # Directory for Mac certs
153- RUN mkdir /etc/certificates
154-
155- # # Python 3
156- # # Comment in if OS does not provide python3.6, which is the current
157- # # production version
158- ENV PYVER=3.6.10
159- ENV PYREV=3.6
60+ # Install current datatracker python dependencies
61+ COPY requirements.txt /
62+ RUN pip install -r /requirements.txt
16063
161- WORKDIR /usr/src
162- RUN wget -q https://www.python.org/ftp/python/$PYVER/Python-$PYVER.tar.xz
163- RUN tar xJf Python-$PYVER.tar.xz
164- RUN rm Python-$PYVER.tar.xz
165- WORKDIR /usr/src/Python-$PYVER/
166- RUN ./configure
167- RUN make
168- RUN make altinstall
169- WORKDIR /usr/src
170- RUN rm -rf /usr/src/Python-$PYVER/
64+ # Turn off rsyslog kernel logging (doesn't work in Docker)
65+ RUN sed -i '/imklog/s/^/#/' /etc/rsyslog.conf
17166
172- ENV HOSTNAME="datatracker"
67+ # Allow access to mariadb over the network
68+ RUN sed -i 's/127.0.0.1/0.0.0.0/' /etc/mysql/mariadb.conf.d/50-server.cnf
17369
174- ENV DDIR="/usr/local/share/datatracker"
175- RUN mkdir -p $DDIR
176- WORKDIR $DDIR
70+ # Turn on mariadb performance_schema
71+ RUN sed -i 's/\[ mysqld\] /\[ mysqld\]\n performance_schema=ON/' /etc/mysql/mariadb.conf.d/50-server.cnf
17772
178- COPY requirements.txt ./
179- COPY setprompt ./
73+ # Make the mariadb sys schema available for possible installation
74+ # We would normally use the next line, but that has a bug:
75+ # ADD https://github.com/FromDual/mariadb-sys/archive/master.zip /
76+ # This is the repo that has the PR:
77+ ADD https://github.com/grooverdan/mariadb-sys/archive/refs/heads/master.zip /
78+ RUN unzip /master.zip
18079
80+ # Copy the startup file
18181COPY docker-init.sh /docker-init.sh
18282RUN chmod +x /docker-init.sh
183- ENTRYPOINT ["/docker-init.sh" ]
18483
185- CMD /bin/bash
84+ WORKDIR /root/src
85+ ENTRYPOINT ["/docker-init.sh" ]
0 commit comments