diff mbox series

[bitbake-devel,RFC,v2,09/18] contrib: Update hashserv Dockerfile

Message ID 20231012221655.632637-10-JPEWhacker@gmail.com
State New
Headers show
Series Bitbake Hash Server WebSockets, Alternate Database Backend, and User Management | expand

Commit Message

Joshua Watt Oct. 12, 2023, 10:16 p.m. UTC
Updates the hash equivalence docker file to the latest Alpine version,
and also to install the required python modules into a virtual
environment

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
---
 contrib/hashserv/Dockerfile       | 33 ++++++++++++++++++++++---------
 contrib/hashserv/requirements.txt |  5 +++++
 2 files changed, 29 insertions(+), 9 deletions(-)
 create mode 100644 contrib/hashserv/requirements.txt
diff mbox series

Patch

diff --git a/contrib/hashserv/Dockerfile b/contrib/hashserv/Dockerfile
index 74b4a3be..7a9525db 100644
--- a/contrib/hashserv/Dockerfile
+++ b/contrib/hashserv/Dockerfile
@@ -9,15 +9,30 @@ 
 #   docker build -f contrib/hashserv/Dockerfile .
 #
 
-FROM alpine:3.13.1
+FROM alpine:3.18.4
 
-RUN apk add --no-cache python3
+RUN apk add --no-cache \
+    python3 \
+    py3-virtualenv \
+    py3-pip
 
-COPY bin/bitbake-hashserv /opt/bbhashserv/bin/
-COPY lib/hashserv /opt/bbhashserv/lib/hashserv/
-COPY lib/bb /opt/bbhashserv/lib/bb/
-COPY lib/codegen.py /opt/bbhashserv/lib/codegen.py
-COPY lib/ply /opt/bbhashserv/lib/ply/
-COPY lib/bs4 /opt/bbhashserv/lib/bs4/
+# Setup virtual environment
+RUN mkdir /opt/hashserver
+WORKDIR /opt/hashserver
 
-ENTRYPOINT ["/opt/bbhashserv/bin/bitbake-hashserv"]
+ENV VIRTUAL_ENV=/opt/hashserver/venv
+RUN python3 -m venv $VIRTUAL_ENV
+ENV PATH="$VIRTUAL_ENV/bin:$PATH"
+RUN pip install -U pip
+
+COPY contrib/hashserv/requirements.txt .
+RUN pip install -r requirements.txt && rm requirements.txt
+
+COPY bin/bitbake-hashserv ./bin/
+COPY lib/hashserv ./lib/hashserv/
+COPY lib/bb ./lib/bb/
+COPY lib/codegen.py ./lib/
+COPY lib/ply ./lib/ply/
+COPY lib/bs4 ./lib/bs4/
+
+ENTRYPOINT ["./bin/bitbake-hashserv"]
diff --git a/contrib/hashserv/requirements.txt b/contrib/hashserv/requirements.txt
new file mode 100644
index 00000000..567a27d4
--- /dev/null
+++ b/contrib/hashserv/requirements.txt
@@ -0,0 +1,5 @@ 
+websockets==11.0.3
+sqlalchemy==2.0.21
+sqlalchemy[asyncio]==2.0.21
+aiosqlite==0.19.0
+asyncpg==0.28.0