Mercurial > p > roundup > code
comparison scripts/Docker/Dockerfile @ 6797:a24ec63759f6
Docker fix healthcheck; allow modules; cleanup; set uid
The docker healthcheck was hardcoded to check the /issues/ tracker.
Replace healthcheck with one that looks for the tracker names on the
roundup-server command line and checks the first one.
During build, additional modules can be specified using
--build-arg="pip_mod=requests setproctitle". This lets the user add
modules unique to the tracker without having to 'docker commit' a new
image from a running container.
Use --build-arg="roundup_uid=2000" to change the uid roundup runs
as. The default is 1000. This is done at build time, not run time.
Remove the sphinx package. All the dependent packages were removed
before, but sphinx wasn't. This led to spurious warnings fom the pip
dependency resolver.
Update docs with changes.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Thu, 21 Jul 2022 00:54:52 -0400 |
| parents | 2eadad009010 |
| children | 4336e655b2be |
comparison
equal
deleted
inserted
replaced
| 6796:5ded9d537eb9 | 6797:a24ec63759f6 |
|---|---|
| 54 tar -Jxvf xapian-bindings-$VER.tar.xz && \ | 54 tar -Jxvf xapian-bindings-$VER.tar.xz && \ |
| 55 cd xapian-bindings-$VER/ && \ | 55 cd xapian-bindings-$VER/ && \ |
| 56 pip --no-cache-dir install sphinx && \ | 56 pip --no-cache-dir install sphinx && \ |
| 57 ./configure --prefix=/usr/local --with-python3 --disable-documentation && \ | 57 ./configure --prefix=/usr/local --with-python3 --disable-documentation && \ |
| 58 make && make install && \ | 58 make && make install && \ |
| 59 pip uninstall --no-cache-dir -y sphinx && \ | |
| 59 pip uninstall --no-cache-dir -y -r $CWD/sphinxdeps.txt | 60 pip uninstall --no-cache-dir -y -r $CWD/sphinxdeps.txt |
| 60 | 61 |
| 61 # add requirements for pip here, e.g. Whoosh, gpg, zstd or other | 62 # add requirements for pip here, e.g. Whoosh, gpg, zstd or other |
| 62 # modules not installed in the base library. | 63 # modules not installed in the base library. |
| 63 # ignore warnings from pip to use virtualenv | 64 # ignore warnings from pip to use virtualenv |
| 64 COPY scripts/Docker/requirements.txt . | 65 COPY scripts/Docker/requirements.txt . |
| 65 RUN pip install --no-cache-dir -r requirements.txt | 66 RUN pip install --no-cache-dir -r requirements.txt |
| 67 | |
| 68 # Allow user to add more modules during build | |
| 69 ARG pip_mod | |
| 70 RUN if [ -n "$pip_mod" ]; then pip install --no-cache-dir ${pip_mod}; fi | |
| 66 | 71 |
| 67 # copy the elements of the release directory to the docker image | 72 # copy the elements of the release directory to the docker image |
| 68 COPY setup.py install/ | 73 COPY setup.py install/ |
| 69 COPY doc install/doc/ | 74 COPY doc install/doc/ |
| 70 COPY frontends install/frontends/ | 75 COPY frontends install/frontends/ |
| 116 # pull over built assets | 121 # pull over built assets |
| 117 COPY --from=build /usr/local/lib/python3.10/site-packages /usr/local/lib/python3.10/site-packages/ | 122 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/ | 123 COPY --from=build /usr/local/bin/roundup* /usr/local/bin/ |
| 119 COPY --from=build /usr/local/share /usr/local/share/ | 124 COPY --from=build /usr/local/share /usr/local/share/ |
| 120 COPY scripts/Docker/roundup_start . | 125 COPY scripts/Docker/roundup_start . |
| 126 COPY scripts/Docker/roundup_healthcheck . | |
| 127 | |
| 128 # make roundup scripts execuable and mount a trackerdir on tracker location | |
| 129 RUN chmod +x roundup_start roundup_healthcheck; mkdir tracker | |
| 130 VOLUME $appdir/tracker | |
| 121 | 131 |
| 122 # map port 8080 to your local port | 132 # map port 8080 to your local port |
| 123 EXPOSE 8080/tcp | 133 EXPOSE 8080/tcp |
| 124 | 134 |
| 125 # mount a trackerdir on tracker location | |
| 126 RUN mkdir tracker | |
| 127 VOLUME $appdir/tracker | |
| 128 | |
| 129 HEALTHCHECK --start-period=1m \ | 135 HEALTHCHECK --start-period=1m \ |
| 130 CMD wget -q -O /dev/null --no-verbose http://localhost:8080/issues/ | 136 CMD ./roundup_healthcheck |
| 131 | 137 |
| 132 # do not run roundup as root. This creates roundup user and group. | 138 # do not run roundup as root. This creates roundup user and group. |
| 133 RUN adduser -D -h /usr/src/app roundup | 139 ARG roundup_uid |
| 140 RUN adduser -D -h ${appdir} -u ${roundup_uid:-1000} roundup | |
| 134 USER roundup | 141 USER roundup |
| 135 | 142 |
| 136 # run the server, disable output buffering so we can see logs. | 143 # run the server, disable output buffering so we can see logs. |
| 137 ENV PYTHONUNBUFFERED=1 | 144 ENV PYTHONUNBUFFERED=1 |
| 138 #ENTRYPOINT [ "roundup-server", "-n", "0.0.0.0" ] | 145 #ENTRYPOINT [ "roundup-server", "-n", "0.0.0.0" ] |
