comparison scripts/Dockerfile @ 6520:26babdf85067

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.
author John Rouillard <rouilj@ieee.org>
date Fri, 05 Nov 2021 14:37:09 -0400
parents
children e6ae8188f61a
comparison
equal deleted inserted replaced
6519:22cf6ee7ad88 6520:26babdf85067
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" ]

Roundup Issue Tracker: http://roundup-tracker.org/