forked from adamlaska/datatracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
91 lines (77 loc) · 2.64 KB
/
Dockerfile
File metadata and controls
91 lines (77 loc) · 2.64 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
# 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:wheezy
MAINTAINER Henrik Levkowetz <henrik@levkowetz.com>
# Default django runserver port
EXPOSE 8000
# Use backports
RUN echo "deb http://http.debian.net/debian wheezy-backports main contrib non-free" >> /etc/apt/sources.list
# Run apt-get noninteractive
ENV DEBIAN_FRONTEND=noninteractive
# Install needed packages
RUN apt-get update && apt-get install -qy \
apt-utils \
ca-certificates \
gawk \
less \
libmysqlclient-dev \
libsvn1/wheezy-backports \
libxml2-dev \
libxslt-dev \
mysql-server \
procps \
pv \
python \
python-dev \
subversion/wheezy-backports \
wget \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# MySQL
VOLUME /var/lib/mysql
# Pip
ENV PYTHONWARNINGS="ignore:a true SSLContext object"
WORKDIR /usr/src
RUN wget -q https://bootstrap.pypa.io/get-pip.py
RUN python get-pip.py
RUN pip --version
RUN pip install virtualenv
# idnits and dependencies
RUN wget -q -P /usr/local/bin/ https://tools.ietf.org/tools/idnits/idnits
RUN chmod +x /usr/local/bin/idnits
# A default user
RUN useradd -m -s /bin/bash -u 500 django
USER django
WORKDIR /home/django
# Check out trunk, in order to verify setup by running tests
RUN mkdir -p ~/src
WORKDIR /home/django/src
RUN svn co https://svn.tools.ietf.org/svn/tools/ietfdb/trunk trunk
# Set up a virtualenv, install requirements, run tests
WORKDIR /home/django/src/trunk
RUN virtualenv .
RUN . bin/activate; pip install -r requirements.txt
COPY settings_local.py ./settings_local.py
RUN . bin/activate; ietf/manage.py test --settings=settings_sqlitetest
USER root
WORKDIR /
COPY docker-init.sh /docker-init.sh
ENTRYPOINT ["/docker-init.sh"]
CMD /bin/bash