From 045c6112c1445bd4ecf24b88687f20227d32a14b Mon Sep 17 00:00:00 2001 From: "Carlo Miguel F. Cruz" Date: Fri, 1 Nov 2024 15:17:08 +0800 Subject: [PATCH] Use python3 venv which is recommended for adhering with PEP 668. Starting alpine:3.19 with py3-pip v23.3.1-r0, py3-pip installations using apk will cause the error `error: externally-managed-environment` when pip attempts to upgrade the pip installation. We now use a virtual env for the test app to avoid this issue. Change-type: patch Signed-off-by: Carlo Miguel F. Cruz --- .github/workflows/flowzone.yml | 1 - Dockerfile.template | 8 +++++--- start.sh | 3 +++ 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/flowzone.yml b/.github/workflows/flowzone.yml index 18d4871..da1598e 100644 --- a/.github/workflows/flowzone.yml +++ b/.github/workflows/flowzone.yml @@ -14,4 +14,3 @@ jobs: (github.event.pull_request.head.repo.full_name != github.repository && github.event_name == 'pull_request_target') uses: product-os/flowzone/.github/workflows/flowzone.yml@master secrets: inherit - with: {} diff --git a/Dockerfile.template b/Dockerfile.template index 2dc2f2b..82f88e5 100644 --- a/Dockerfile.template +++ b/Dockerfile.template @@ -1,11 +1,13 @@ FROM balenalib/%%RESIN_MACHINE_NAME%%-alpine:latest -RUN apk update && apk add bash py-pip lockfile-progs --no-cache && \ +WORKDIR /usr/src/app + +RUN apk update && apk add bash python3 lockfile-progs --no-cache && \ + python3 -m venv venv && \ + source venv/bin/activate && \ pip install --upgrade pip && \ pip install flask -WORKDIR /usr/src/app - COPY . ./ CMD ["bash", "start.sh"] diff --git a/start.sh b/start.sh index 2bc464f..35f05e6 100644 --- a/start.sh +++ b/start.sh @@ -1,4 +1,7 @@ #!/bin/bash + +source venv/bin/activate + python server.py & for ((i=1;i<=5;i++)); do