-
Notifications
You must be signed in to change notification settings - Fork 8
/
Dockerfile
30 lines (24 loc) · 950 Bytes
/
Dockerfile
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
FROM python:3.12-bookworm
WORKDIR /usr/src/app
COPY requirements.txt /usr/src/app
RUN apt update && \
apt dist-upgrade -y && \
apt install -y --no-install-recommends \
wait-for-it \
default-mysql-client \
libmariadb-dev-compat \
libmariadb-dev \
python3-dev
RUN pip3 install --upgrade pip setuptools wheel && \
pip3 install --no-cache-dir -r requirements.txt
COPY . /usr/src/app
# Docker specific configuration
# MySQL is on a different host now
# To expose app, it must listen to 0.0.0.0 and not localhost
# wait-for-it must only one command.
RUN sed -i 's/mysql/mysql -h BAR_mysqldb/' ./config/init.sh && \
sed -i 's/localhost/BAR_mysqldb/' ./config/BAR_API.cfg && \
sed -i 's/run()/run(host="0.0.0.0")/' ./app.py && \
echo "pytest -s" >> ./config/init.sh && \
echo "python3 app.py" >> ./config/init.sh && \
echo "CACHE_REDIS_HOST = 'BAR_redis'" >> ./config/BAR_API.cfg