Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 1 | # SPDX-License-Identifier: MIT |
| 2 | # |
| 3 | # Copyright (c) 2022 Daniel Gomez <daniel@qtec.com> |
| 4 | # |
| 5 | # Dockerfile to build a bitbake PR service container |
| 6 | # |
| 7 | # From the root of the bitbake repository, run: |
| 8 | # |
| 9 | # docker build -f contrib/prserv/Dockerfile . -t prserv |
| 10 | # |
| 11 | # Running examples: |
| 12 | # |
| 13 | # 1. PR Service in RW mode, port 18585: |
| 14 | # |
| 15 | # docker run --detach --tty \ |
| 16 | # --env PORT=18585 \ |
| 17 | # --publish 18585:18585 \ |
| 18 | # --volume $PWD:/var/lib/bbprserv \ |
| 19 | # prserv |
| 20 | # |
| 21 | # 2. PR Service in RO mode, default port (8585) and custom LOGFILE: |
| 22 | # |
| 23 | # docker run --detach --tty \ |
| 24 | # --env DBMODE="--read-only" \ |
| 25 | # --env LOGFILE=/var/lib/bbprserv/prservro.log \ |
| 26 | # --publish 8585:8585 \ |
| 27 | # --volume $PWD:/var/lib/bbprserv \ |
| 28 | # prserv |
| 29 | # |
| 30 | |
| 31 | FROM alpine:3.14.4 |
| 32 | |
| 33 | RUN apk add --no-cache python3 |
| 34 | |
| 35 | COPY bin/bitbake-prserv /opt/bbprserv/bin/ |
| 36 | COPY lib/prserv /opt/bbprserv/lib/prserv/ |
| 37 | COPY lib/bb /opt/bbprserv/lib/bb/ |
| 38 | COPY lib/codegen.py /opt/bbprserv/lib/codegen.py |
| 39 | COPY lib/ply /opt/bbprserv/lib/ply/ |
| 40 | COPY lib/bs4 /opt/bbprserv/lib/bs4/ |
| 41 | |
| 42 | ENV PATH=$PATH:/opt/bbprserv/bin |
| 43 | |
| 44 | RUN mkdir -p /var/lib/bbprserv |
| 45 | |
| 46 | ENV DBFILE=/var/lib/bbprserv/prserv.sqlite3 \ |
| 47 | LOGFILE=/var/lib/bbprserv/prserv.log \ |
| 48 | LOGLEVEL=debug \ |
| 49 | HOST=0.0.0.0 \ |
| 50 | PORT=8585 \ |
| 51 | DBMODE="" |
| 52 | |
| 53 | ENTRYPOINT [ "/bin/sh", "-c", \ |
| 54 | "bitbake-prserv \ |
| 55 | --file=$DBFILE \ |
| 56 | --log=$LOGFILE \ |
| 57 | --loglevel=$LOGLEVEL \ |
| 58 | --start \ |
| 59 | --host=$HOST \ |
| 60 | --port=$PORT \ |
| 61 | $DBMODE \ |
| 62 | && tail -f $LOGFILE"] |