-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile-api
41 lines (34 loc) · 1.31 KB
/
Dockerfile-api
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
# syntax=docker/dockerfile:1
FROM registry.fedoraproject.org/fedora:39
USER root
RUN mkdir BASIL-API
WORKDIR /BASIL-API
COPY api/ /BASIL-API/api
COPY db/ /BASIL-API/db
COPY misc/ /BASIL-API/misc
COPY requirements.txt pyproject.toml /BASIL-API/
RUN dnf install -y curl git patch python3 python3-pip podman rsync && \
pip3 install --no-cache-dir -r requirements.txt
# Set the public ip in the api/api_url.py
ARG API_PORT=5000
ARG 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 && \
python3 init_db.py && \
chmod a+rw /BASIL-API/db
# Apply patches
RUN patch -u /usr/local/lib/python3.12/site-packages/tmt/steps/provision/podman.py < /BASIL-API/misc/tmt_provision_podman.patch
# Init tmt
RUN 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}" && 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