-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
31 lines (25 loc) · 1017 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
31
FROM python:3.11.4-slim@sha256:7ad180fdf785219c4a23124e53745fbd683bd6e23d0885e3554aff59eddbc377
# required for psychopg2
RUN apt-get update && \
apt-get install -y libpq-dev gcc
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
APP_HOME=/app \
# HTTP port to listen to.
PORT=3333 \
# Postgres connection string.
# use postgresql://username:XXX@host/db for normal postgres connections,
# or use the default value below for cloudsql without auth proxy
PG_CONN_STR=postgresql+pg8000:// \
# CloudSQL connection variables. Safe to ignore if connecting to a regular
# postgres db with the full connection string in $PG_CONN_STR
INSTANCE_CONNECTION_NAME=NONE \
DB_USER=NONE \
DB_PASS=NONE \
DB_NAME=NONE \
PRIVATE_IP=0
WORKDIR $APP_HOME
COPY . ./
RUN pip install --no-cache-dir -r requirements.txt
# As an example here we're running the web service with 2 workers on uvicorn.
CMD exec uvicorn server.main:app --host 0.0.0.0 --port ${PORT} --workers 2