-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
47 lines (33 loc) · 1.32 KB
/
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
FROM python:3.11-slim
WORKDIR /server
# run pip install first + cache it
COPY requirements.txt requirements.txt
RUN pip install -r requirements.txt
# slower but more space efficient
# RUN pip install --no-cache-dir -r requirements.txt
RUN apt-get update && apt-get install -y default-mysql-client
# Copy SSL certificates and client id & secret
COPY secrets/cert.pem /secrets/cert.pem
COPY secrets/key.pem /secrets/key.pem
COPY secrets/tokens.yaml /secrets/tokens.yaml
# Copy application code
COPY . .
# Create log directory
RUN mkdir -p /logs
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
ENV ENVIRONMENT="container"
ENV LOG_CFG="logging_config.yaml"
ENV SECRETS_DIR="/secrets/tokens.yaml"
ENV DBNAME="lurkerbothunterdb"
ENV DB_SERVICE_NAME="db"
ENV DB_PORT="3306"
ENV REDIS_HOST="localhost"
ENV REDIS_PORT="6379"
ENV REDIS_DB_INDEX="0"
COPY ./secrets/.mysql_root_password.txt /run/secrets/mysql_root_password
COPY ./secrets/.mysql_user_password.txt /run/secrets/mysql_user_password
COPY ./secrets/.testdb_user_password.txt /run/secrets/testdb_user_password
RUN chmod 400 /run/secrets/mysql_root_password /run/secrets/mysql_user_password /run/secrets/testdb_user_password
EXPOSE 443
CMD ["uvicorn", "server:app", "--host", "0.0.0.0", "--port", "443", "--ssl-keyfile", "/secrets/key.pem", "--ssl-certfile", "/secrets/cert.pem"]