Skip to content

Commit 9cd52ed

Browse files
committed
issue2551163 - add starter docker
This works but I should be able to shrink it by 10MB (to 75 or so) by doing a multi-stage build. Also this only supports anydbm/sqlite at the moment. So the saved space will be used by mysql and pgsql drivers before I am done. Based on alipine linux python image. Invoke with: docker run --rm -v /.../issue.tracker:/usr/src/app/tracker \ -p 9017:8080 roundup-app:latest you can also append tracker specifications like: inhouse=tracker/inhouse customer=tracker/customer to the docker command to start up two trackers on the two tracker homes on the volume mounted at (/usr/src/apps/) tracker.
1 parent d2b0f9f commit 9cd52ed

File tree

2 files changed

+85
-0
lines changed

2 files changed

+85
-0
lines changed

scripts/Dockerfile

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# build in root dir using:
2+
# docker build -t roundup-app --rm -f Dockerfile ..
3+
#
4+
# run using:
5+
# docker run --rm -v /home/rouilj/develop/roundup.sysadmin/issue.tracker:/usr/src/app/tracker -p 9017:8080 roundup-app:latest
6+
7+
FROM python:3-alpine
8+
9+
ENV appdir=/usr/src/app
10+
WORKDIR $appdir
11+
12+
# allow roundup install from local directory or from pypi
13+
ARG source=local
14+
15+
LABEL "org.roundup-tracker.vendor"="Roundup Issue Tracker Team" \
16+
"org.roundup-tracker.description"="Roundup Issue Tracker using sqlite" \
17+
"version"="2.1.0 $source"
18+
19+
# add requirements for pip here, e.g. pytz or other modules
20+
# ignore warnings from pip to use virtualenv
21+
COPY scripts/requirements.txt .
22+
RUN pip install --no-cache-dir -r requirements.txt
23+
24+
# copy the elements of the release directory to the docker image
25+
COPY setup.py install/
26+
COPY doc install/doc/
27+
COPY frontends install/frontends/
28+
COPY locale install/locale/
29+
COPY roundup install/roundup/
30+
COPY share install/share/
31+
32+
# verify source has one of two valid values then
33+
# install in python3 standard directories from local copy
34+
# or install in python3 standard directories from pypi using pip
35+
36+
RUN if [ "$source" == "local" ] || [ "$source" == "pypi" ]; then :; \
37+
else echo "invalid value for source: $source"; \
38+
echo "must be local or pypi"; exit 1; fi; \
39+
if [ "$source" == "local" ]; then cd install && ./setup.py install; fi; \
40+
if [ "$source" == "pypi" ]; then pip install roundup; fi
41+
42+
# delete source files
43+
RUN rm -rf install
44+
45+
# map port 8080 to your local port
46+
EXPOSE 8080/tcp
47+
48+
# mount a trackerdir on tracker location
49+
RUN mkdir tracker
50+
VOLUME $appdir/tracker
51+
52+
# do not run roundup as root
53+
RUN adduser -D roundup
54+
55+
# run the server
56+
USER roundup
57+
ENTRYPOINT [ "roundup-server", "-L", "-n", "0.0.0.0" ]
58+
59+
# allow the invoker to override cmd with multiple trackers
60+
# in each subdirectory under $appdir/tracker. E.G.
61+
# docker run .... \
62+
# issues=tracker/issues foo=tracker/foo
63+
#
64+
# note using "issue=$appdir/tracker" results in error:
65+
#
66+
# No valid configuration files found in directory /usr/src/app/$appdir/tracker
67+
#
68+
# so $appdir not expanded and $PWD prefixed onto the (relative path)
69+
# $appdir/tracker. Hence use relative path for spec.
70+
CMD [ "issues=tracker" ]

scripts/requirements.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# human timezones
2+
pytz
3+
# indexer
4+
Whoosh
5+
# databases - need devel and other files installed to be built.
6+
#psycopg2==2.7.4
7+
#mysqlclient==1.3.10
8+
# encryption - need additional packages
9+
#gpg==1.10.0
10+
# java web tokens
11+
PyJWT==1.7.1
12+
# extra compression support - build needs gcc
13+
#Brotli==1.0.4
14+
#zstd==1.5.0.2
15+

0 commit comments

Comments
 (0)