comparison scripts/Docker/Dockerfile @ 6638:e1588ae185dc issue2550923_computed_property

merge from default branch. Fix travis.ci so CI builds don't error out
author John Rouillard <rouilj@ieee.org>
date Thu, 21 Apr 2022 16:54:17 -0400
parents c3c636feace3
children 2eadad009010
comparison
equal deleted inserted replaced
6508:85db90cc1705 6638:e1588ae185dc
1 # build in root dir using:
2 #
3 # docker build -t roundup-app --rm -f scripts/Dockerfile .
4 #
5 # run using:
6 #
7 # docker run --rm -v /.../issue.tracker:/usr/src/app/tracker \
8 # -p 9017:8080 roundup-app:latest
9
10
11 # Global vars for all build stages
12
13 # application directory
14 ARG appdir=/usr/src/app
15
16 # support roundup install from 'local' directory,
17 # 'local_pip' local directory using pip to install or
18 # latest release from 'pypi'
19 ARG source=local
20
21 FROM python:3-alpine as build
22
23 # Inherit global values https://github.com/moby/moby/issues/37345
24 ARG appdir
25
26 WORKDIR $appdir
27
28 # Add packages needed to compile mysql, pgsql and other python modules.
29 # Can't use apk to add them as that installs a 3.9 python version.
30 # g++ installs cc1plus needed by pip install
31 RUN apk add \
32 g++ \
33 gcc \
34 gpgme-dev \
35 libxapian \
36 linux-headers \
37 make \
38 musl-dev \
39 mysql-dev \
40 postgresql-dev \
41 swig \
42 xapian-core-dev
43
44 # build xapian bindings:
45 # file with sphinx build dependencies to remove after build
46 # they are over 70MB of space.
47 COPY scripts/Docker/sphinxdeps.txt .
48
49 RUN set -xv && CWD=$PWD && \
50 VER=$(apk list -I 'xapian-core-dev' | \
51 sed 's/^xapian-core-dev-\([0-9.]*\)-.*/\1/') && \
52 cd /tmp && \
53 wget https://oligarchy.co.uk/xapian/$VER/xapian-bindings-$VER.tar.xz && \
54 tar -Jxvf xapian-bindings-$VER.tar.xz && \
55 cd xapian-bindings-$VER/ && \
56 pip --no-cache-dir install sphinx==1.8.5 && \
57 ./configure --prefix=/usr/local --with-python3 --disable-documentation && \
58 make && make install && \
59 pip uninstall --no-cache-dir -y -r $CWD/sphinxdeps.txt
60
61 # add requirements for pip here, e.g. Whoosh, gpg, zstd or other
62 # modules not installed in the base library.
63 # ignore warnings from pip to use virtualenv
64 COPY scripts/Docker/requirements.txt .
65 RUN pip install --no-cache-dir -r requirements.txt
66
67 # copy the elements of the release directory to the docker image
68 COPY setup.py install/
69 COPY doc install/doc/
70 COPY frontends install/frontends/
71 COPY locale install/locale/
72 COPY roundup install/roundup/
73 COPY share install/share/
74
75 # verify source has one of two valid values then
76 # install in python3 standard directories from local copy
77 # or install in python3 standard directories from pypi using pip
78 # import from global/command line
79 ARG source
80 RUN set -xv && if [ "$source" = "local" ] || \
81 [ "$source" = "pypi" ] || \
82 [ "$source" = "local_pip" ]; then :; \
83 else echo "invalid value for source: $source"; \
84 echo "must be local or pypi"; exit 1; fi; \
85 if [ "$source" = "local" ]; then cd install && ./setup.py install; fi; \
86 if [ "$source" = "local_pip" ]; then cd install && pip install \
87 --use-feature=in-tree-build . ; fi; \
88 if [ "$source" = "pypi" ]; then pip install roundup; \
89 cp -ril /usr/local/lib/python3.10/site-packages/usr/local/share/* \
90 /usr/local/share; fi
91
92 # build a new smaller docker image for execution. Build image above
93 # is 1G in size.
94 FROM python:3-alpine
95
96 # import from global
97 ARG appdir
98
99 WORKDIR $appdir
100
101 # add libraries needed to run gpg/mysql/pgsql/brotli
102 RUN apk add \
103 gpgme \
104 mariadb-connector-c \
105 libpq \
106 libstdc++ \
107 libxapian
108
109 ARG source
110 LABEL "org.roundup-tracker.vendor"="Roundup Issue Tracker Team" \
111 "org.roundup-tracker.description"="Roundup Issue Tracker using sqlite" \
112 "version"="2.1.0 $source" \
113 "org.opencontainers.image.authors"="roundup-devel@lists.sourceforge.net"
114
115
116 # pull over built assets
117 COPY --from=build /usr/local/lib/python3.10/site-packages /usr/local/lib/python3.10/site-packages/
118 COPY --from=build /usr/local/bin/roundup* /usr/local/bin/
119 COPY --from=build /usr/local/share /usr/local/share/
120 COPY scripts/Docker/roundup_start .
121
122 # map port 8080 to your local port
123 EXPOSE 8080/tcp
124
125 # mount a trackerdir on tracker location
126 RUN mkdir tracker
127 VOLUME $appdir/tracker
128
129 HEALTHCHECK --start-period=1m \
130 CMD wget -q -O /dev/null --no-verbose http://localhost:8080/issues/
131
132 # do not run roundup as root
133 RUN adduser -D -h /usr/src/app roundup
134 USER roundup
135
136 # run the server, disable output buffering so we can see logs.
137 ENV PYTHONUNBUFFERED=1
138 #ENTRYPOINT [ "roundup-server", "-n", "0.0.0.0" ]
139 ENTRYPOINT [ "./roundup_start" ]
140
141 # allow the invoker to override cmd with multiple trackers
142 # in each subdirectory under $appdir/tracker. E.G.
143 # docker run .... \
144 # issues=tracker/issues foo=tracker/foo
145 #
146 # note using "issue=$appdir/tracker" results in error:
147 #
148 # No valid configuration files found in directory /usr/src/app/$appdir/tracker
149 #
150 # so $appdir not expanded and $PWD prefixed onto the (relative path)
151 # $appdir/tracker. Hence use relative path for spec.
152 CMD [ "issues=tracker" ]

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