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 23:16:51
Message-Id: 1581290195.bca3c0151fcb2fa409c26bc28044eba297250822.sping@gentoo
1 commit: bca3c0151fcb2fa409c26bc28044eba297250822
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 23:16:35 2020 +0000
6 URL: https://gitweb.gentoo.org/proj/euscan.git/commit/?id=bca3c015
7
8 docker: Dockerize euscanwww (W.I.P.)
9
10 Signed-off-by: Sebastian Pipping <sping <AT> gentoo.org>
11
12 Dockerfile | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++
13 docker-compose.yml | 44 ++++++++++++++++++++++++++++++++++
14 docker-entrypoint.sh | 20 ++++++++++++++++
15 requirements.txt | 41 ++++++++++++++++++++++++++++++++
16 4 files changed, 172 insertions(+)
17
18 diff --git a/Dockerfile b/Dockerfile
19 new file mode 100644
20 index 0000000..9dda8ec
21 --- /dev/null
22 +++ b/Dockerfile
23 @@ -0,0 +1,67 @@
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 +
76 +WORKDIR /tmp/euscan/
77 +RUN pip2 install --user .
78 +
79 +RUN pip2 check
80 +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)'
81 +
82 +COPY euscanwww/ /tmp/euscan/euscanwww/
83 +
84 +COPY docker-entrypoint.sh /root/
85 +
86 +WORKDIR /tmp/euscan/euscanwww/
87 +
88 +EXPOSE 55080
89 +ENTRYPOINT ["/root/docker-entrypoint.sh"]
90 +CMD []
91
92 diff --git a/docker-compose.yml b/docker-compose.yml
93 new file mode 100644
94 index 0000000..4daf0e2
95 --- /dev/null
96 +++ b/docker-compose.yml
97 @@ -0,0 +1,44 @@
98 +# Copyright 2020 Gentoo Authors
99 +# Licensed under the GNU General Public License v2
100 +
101 +version: "3"
102 +
103 +services:
104 + runserver:
105 + depends_on:
106 + - celeryd
107 + image: ${COMPOSE_PROJECT_NAME}_celeryd:latest
108 + environment:
109 + DJANGO_SETTINGS_MODULE: euscanwww.settings
110 + EUSCAN_SECRET_KEY: ${EUSCAN_SECRET_KEY:?}
111 + volumes:
112 + - "./euscanwww/:/tmp/euscan/euscanwww/"
113 + - "./pym/euscan/:/root/.local/lib64/python2.7/site-packages/euscan"
114 + ports:
115 + - "127.0.0.1:55080:55080"
116 + tty: true
117 +
118 + celerycam:
119 + depends_on:
120 + - celeryd
121 + image: ${COMPOSE_PROJECT_NAME}_celeryd:latest
122 + environment:
123 + DJANGO_SETTINGS_MODULE: euscanwww.settings
124 + EUSCAN_SECRET_KEY: ${EUSCAN_SECRET_KEY:?}
125 + volumes:
126 + - "./euscanwww/:/tmp/euscan/euscanwww/"
127 + - "./pym/euscan/:/root/.local/lib64/python2.7/site-packages/euscan"
128 + command: python2 manage.py celerycam
129 + tty: true
130 +
131 + celeryd:
132 + build:
133 + context: .
134 + environment:
135 + DJANGO_SETTINGS_MODULE: euscanwww.settings
136 + EUSCAN_SECRET_KEY: ${EUSCAN_SECRET_KEY:?}
137 + volumes:
138 + - "./euscanwww/:/tmp/euscan/euscanwww/"
139 + - "./pym/euscan/:/root/.local/lib64/python2.7/site-packages/euscan"
140 + command: python2 manage.py celeryd -B -E -l INFO
141 + tty: true
142
143 diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh
144 new file mode 100755
145 index 0000000..4d27768
146 --- /dev/null
147 +++ b/docker-entrypoint.sh
148 @@ -0,0 +1,20 @@
149 +#! /usr/bin/env bash
150 +# Copyright 2020 Gentoo Authors
151 +# Licensed under the GNU General Public License v2
152 +
153 +set -e
154 +set -u
155 +
156 +PS4='# '
157 +set -x
158 +
159 +id
160 +ip addr
161 +
162 +if [[ $# -gt 0 ]]; then
163 + exec "$@"
164 +fi
165 +
166 +python2 manage.py migrate
167 +
168 +exec python2 manage.py runserver 0.0.0.0:55080
169
170 diff --git a/requirements.txt b/requirements.txt
171 new file mode 100644
172 index 0000000..cde5aa8
173 --- /dev/null
174 +++ b/requirements.txt
175 @@ -0,0 +1,41 @@
176 +# Direct dependencies (testing)
177 +factory-boy==1.1.3
178 +
179 +# Direct dependencies (command line utility)
180 +BeautifulSoup==3.2.1
181 +
182 +# Direct dependencies (web interface)
183 +ansi2html==0.9.1
184 +Django==1.8
185 +django-annoying==0.10.4
186 +django-auth-ldap==1.1
187 +django-celery==3.3.1
188 +django-piston==0.2.3
189 +django-recaptcha==0.0.4
190 +django-registration==2.4.1
191 +matplotlib==2.2.5
192 +python-ldap==2.4.10
193 +
194 +# Indirect dependencies
195 +anyjson==0.3.3
196 +amqp==1.4.9 # <2.0 due to kombu 3.0.37
197 +backports.functools-lru-cache==1.6.1
198 +billiard==3.3.0.23 # <3.4 due to celery==3.1.25
199 +celery==3.1.25 # >=4 does not have celery.utils.timeutils
200 +configparser==4.0.2
201 +confusable-homoglyphs==3.2.0
202 +contextlib2==0.6.0.post1
203 +cycler==0.10.0
204 +importlib-metadata==1.5.0
205 +kiwisolver==1.1.0
206 +kombu==3.0.37 # <3.1 due to celery==3.1.25
207 +numpy==1.16.6
208 +pathlib2==2.3.5
209 +pyparsing==2.4.6
210 +python-dateutil==2.8.1
211 +pytz==2019.3
212 +scandir==1.10.0
213 +six==1.14.0
214 +subprocess32==3.5.4
215 +vine==1.3.0
216 +zipp==1.1.0