blob: 9585fe3f076cf2c7b926e865ef15e0bb30cb0cab [file] [log] [blame]
Andrew Geissler9aee5002022-03-30 16:27:02 +00001# 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
31FROM alpine:3.14.4
32
33RUN apk add --no-cache python3
34
35COPY bin/bitbake-prserv /opt/bbprserv/bin/
36COPY lib/prserv /opt/bbprserv/lib/prserv/
37COPY lib/bb /opt/bbprserv/lib/bb/
38COPY lib/codegen.py /opt/bbprserv/lib/codegen.py
39COPY lib/ply /opt/bbprserv/lib/ply/
40COPY lib/bs4 /opt/bbprserv/lib/bs4/
41
42ENV PATH=$PATH:/opt/bbprserv/bin
43
44RUN mkdir -p /var/lib/bbprserv
45
46ENV 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
53ENTRYPOINT [ "/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"]