Gentoo Archives: gentoo-commits

From: Sebastian Pipping <sping@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/euscan:docker-compose--wip--expect-force-pushes commit in: /
Date: Sun, 09 Feb 2020 21:25:13
Message-Id: 1581283494.f3cfe82d587d5efa73b828a1f69e3fa0136bdc1d.sping@gentoo
1 commit: f3cfe82d587d5efa73b828a1f69e3fa0136bdc1d
2 Author: Sebastian Pipping <sping <AT> gentoo <DOT> org>
3 AuthorDate: Sat Feb 8 18:40:50 2020 +0000
4 Commit: Sebastian Pipping <sping <AT> gentoo <DOT> org>
5 CommitDate: Sun Feb 9 21:24:54 2020 +0000
6 URL: https://gitweb.gentoo.org/proj/euscan.git/commit/?id=f3cfe82d
7
8 docker: Dockerize euscanwww (W.I.P.)
9
10 Signed-off-by: Sebastian Pipping <sping <AT> gentoo.org>
11
12 Dockerfile | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++
13 docker-compose.yml | 33 +++++++++++++++++++++++++
14 docker-entrypoint.sh | 24 ++++++++++++++++++
15 requirements.txt | 42 +++++++++++++++++++++++++++++++
16 4 files changed, 169 insertions(+)
17
18 diff --git a/Dockerfile b/Dockerfile
19 new file mode 100644
20 index 0000000..c8e088d
21 --- /dev/null
22 +++ b/Dockerfile
23 @@ -0,0 +1,70 @@
24 +# Copyright 2020 Gentoo Authors
25 +# Licensed under the GNU General Public License v2
26 +
27 +FROM gentoo/stage3-amd64:20200208
28 +
29 +RUN wget https://gentoo.osuosl.org/snapshots/gentoo-latest.tar.xz \
30 + && \
31 + tar -C /var/db/repos/ -x -p -f gentoo-latest.tar.xz \
32 + && \
33 + mv /var/db/repos/gentoo-20??????/ /var/db/repos/gentoo/ \
34 + && \
35 + rm gentoo-latest.tar.xz
36 +
37 +RUN emaint sync --repo gentoo
38 +
39 +RUN eselect profile show \
40 + && \
41 + echo 'net-analyzer/rrdtool python' > /etc/portage/package.use/net-analyzer--rrdtool \
42 + && \
43 + echo 'dev-lang/python:2.7 sqlite tk' > /etc/portage/package.use/dev-lang--python \
44 + && \
45 + echo 'PYTHON_TARGETS="${PYTHON_TARGETS} python2_7"' >> /etc/portage/make.conf \
46 + && \
47 + echo 'PYTHON_SINGLE_TARGET="python2_7"' >> /etc/portage/make.conf \
48 + && \
49 + echo 'USE="${USE} bindist -syslog"' >> /etc/portage/make.conf
50 +
51 +# NOTE: First build dependencies, then runtime-only dependencies
52 +RUN emerge --tree -v -j2 --color y -1uU \
53 + dev-lang/python:2.7 \
54 + dev-libs/cyrus-sasl \
55 + dev-python/pip \
56 + dev-python/setuptools \
57 + dev-python/wheel \
58 + net-nds/openldap \
59 + \
60 + app-portage/eix \
61 + app-portage/gentoolkit \
62 + app-portage/layman \
63 + net-analyzer/rrdtool \
64 + sys-apps/portage \
65 + && \
66 + rm -f /var/cache/distfiles/*
67 +
68 +ENV PATH=/root/.local/bin/:${PATH}
69 +COPY requirements.txt /tmp/euscan/
70 +RUN pip2 install --user -r /tmp/euscan/requirements.txt
71 +
72 +COPY setup.py README.rst /tmp/euscan/
73 +COPY bin/ /tmp/euscan/bin/
74 +COPY pym/ /tmp/euscan/pym/
75 +COPY euscanwww/djeuscan/ /tmp/euscan/pym/djeuscan/
76 +COPY euscanwww/euscan_accounts/ /tmp/euscan/pym/euscan_accounts/
77 +COPY euscanwww/euscan_captcha/ /tmp/euscan/pym/euscan_captcha/
78 +COPY euscanwww/euscanwww/ /tmp/euscan/pym/euscanwww/
79 +
80 +COPY docker-entrypoint.sh /root/
81 +
82 +WORKDIR /tmp/euscan/
83 +
84 +RUN pip2 install --user .
85 +
86 +RUN pip2 check
87 +RUN bash -c 'diff -U0 <(pip2 freeze --user | sed "/^\(euscan\|virtualenv\)==/d" | sort -f) <(sed -e "s/ *#.*//" -e "/^$/d" /tmp/euscan/requirements.txt | sort -f)'
88 +
89 +RUN rm -Rf /tmp/euscan/
90 +
91 +EXPOSE 55080
92 +ENTRYPOINT ["/root/docker-entrypoint.sh"]
93 +CMD []
94
95 diff --git a/docker-compose.yml b/docker-compose.yml
96 new file mode 100644
97 index 0000000..5bcec2f
98 --- /dev/null
99 +++ b/docker-compose.yml
100 @@ -0,0 +1,33 @@
101 +# Copyright 2020 Gentoo Authors
102 +# Licensed under the GNU General Public License v2
103 +
104 +version: "3"
105 +
106 +services:
107 + runserver:
108 + depends_on:
109 + - celeryd
110 + image: ${COMPOSE_PROJECT_NAME}_celeryd:latest
111 + environment:
112 + DJANGO_SETTINGS_MODULE: euscanwww.settings
113 + EUSCAN_SECRET_KEY: ${EUSCAN_SECRET_KEY:?}
114 + tty: true
115 +
116 + celerycam:
117 + depends_on:
118 + - celeryd
119 + image: ${COMPOSE_PROJECT_NAME}_celeryd:latest
120 + environment:
121 + DJANGO_SETTINGS_MODULE: euscanwww.settings
122 + EUSCAN_SECRET_KEY: ${EUSCAN_SECRET_KEY:?}
123 + command: django-admin celerycam
124 + tty: true
125 +
126 + celeryd:
127 + build:
128 + context: .
129 + environment:
130 + DJANGO_SETTINGS_MODULE: euscanwww.settings
131 + EUSCAN_SECRET_KEY: ${EUSCAN_SECRET_KEY:?}
132 + command: django-admin celeryd -B -E -l INFO
133 + tty: true
134
135 diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh
136 new file mode 100755
137 index 0000000..508d265
138 --- /dev/null
139 +++ b/docker-entrypoint.sh
140 @@ -0,0 +1,24 @@
141 +#! /usr/bin/env bash
142 +# Copyright 2020 Gentoo Authors
143 +# Licensed under the GNU General Public License v2
144 +
145 +set -e
146 +set -u
147 +
148 +PS4='# '
149 +set -x
150 +
151 +id
152 +ip addr
153 +
154 +manage_py() {
155 + django-admin "$@"
156 +}
157 +
158 +if [[ $# -gt 0 ]]; then
159 + exec "$@"
160 +fi
161 +
162 +manage_py migrate
163 +
164 +exec manage_py runserver 0.0.0.0:55080
165
166 diff --git a/requirements.txt b/requirements.txt
167 new file mode 100644
168 index 0000000..8bfe7f6
169 --- /dev/null
170 +++ b/requirements.txt
171 @@ -0,0 +1,42 @@
172 +# Direct dependencies (testing)
173 +factory-boy==1.1.3
174 +
175 +# Direct dependencies (command line utility)
176 +BeautifulSoup==3.2.1
177 +
178 +# Direct dependencies (web interface)
179 +ansi2html==0.9.1
180 +Django==1.8
181 +django-annoying==0.7.6
182 +django-auth-ldap==1.1
183 +django-celery==3.3.1
184 +django-piston==0.2.3
185 +django-recaptcha==0.0.4
186 +django-registration==2.4.1
187 +matplotlib==2.2.5
188 +python-ldap==2.4.10
189 +South==0.7
190 +
191 +# Indirect dependencies
192 +anyjson==0.3.3
193 +amqp==1.4.9 # <2.0 due to kombu 3.0.37
194 +backports.functools-lru-cache==1.6.1
195 +billiard==3.3.0.23 # <3.4 due to celery==3.1.25
196 +celery==3.1.25 # >=4 does not have celery.utils.timeutils
197 +configparser==4.0.2
198 +confusable-homoglyphs==3.2.0
199 +contextlib2==0.6.0.post1
200 +cycler==0.10.0
201 +importlib-metadata==1.5.0
202 +kiwisolver==1.1.0
203 +kombu==3.0.37 # <3.1 due to celery==3.1.25
204 +numpy==1.16.6
205 +pathlib2==2.3.5
206 +pyparsing==2.4.6
207 +python-dateutil==2.8.1
208 +pytz==2019.3
209 +scandir==1.10.0
210 +six==1.14.0
211 +subprocess32==3.5.4
212 +vine==1.3.0
213 +zipp==1.1.0