-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathContainerfile-api-debian
48 lines (40 loc) · 1.58 KB
/
Containerfile-api-debian
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
FROM debian:12
USER root
RUN mkdir BASIL-API
WORKDIR /BASIL-API
RUN apt update && apt install --assume-yes \
curl git patch podman \
python3 python3-pip python3-virtualenv \
rsync
COPY . .
RUN virtualenv penv && \
. penv/bin/activate && \
pip3 install --no-cache-dir -r requirements.txt
# Set the public ip in the api/api_url.py
ARG API_PORT=5000 \
ADMIN_PASSWORD=admin
ENV BASIL_ADMIN_PASSWORD=${ADMIN_PASSWORD} \
BASIL_API_PORT=${API_PORT}
# Init the database and
# Write permission to db
RUN mkdir -p /var/tmp && \
cd /BASIL-API/db/models && \
. /BASIL-API/penv/bin/activate && \
python3 init_db.py && \
chmod a+rw /BASIL-API/db
# Apply patches and init tmt
RUN patch -u /BASIL-API/penv/lib/python3.11/site-packages/tmt/steps/provision/podman.py < /BASIL-API/misc/tmt_provision_podman.patch && \
patch -u /BASIL-API/penv/lib/python3.11/site-packages/tmt/steps/provision/podman.py < /BASIL-API/misc/tmt_provision_podman_debian.patch && \
patch -u /BASIL-API/penv/lib/python3.11/site-packages/tmt/package_managers/apt.py < /BASIL-API/misc/tmt_provision_podman_debian_apt.patch && \
. /BASIL-API/penv/bin/activate && tmt init
# Remove BASIL ADMIN PASSWORD from the environment
ENV BASIL_ADMIN_PASSWORD=
EXPOSE ${BASIL_API_PORT}
CMD echo "BASIL_API_PORT: ${BASIL_API_PORT}" && \
. /BASIL-API/penv/bin/activate && \
cd api && \
gunicorn \
--timeout 120 \
--access-logfile /var/tmp/gunicorn-access.log \
--error-logfile /var/tmp/gunicorn-error.log \
--bind 0.0.0.0:${BASIL_API_PORT} api:app 2>&1 | tee /var/tmp/basil-api-error.log