aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar ks129 <[email protected]>2020-11-22 08:48:29 +0200
committerGravatar ks129 <[email protected]>2020-11-22 08:48:29 +0200
commitb2fc8a54f353524f98322b50d5ed06154212d4a9 (patch)
treeaea247d3e5b5664376b92d2dd9d4579e20794c6c
parentMove CORS allowed origins to environment variable (diff)
Create Dockerfile for project
-rw-r--r--Dockerfile27
1 files changed, 27 insertions, 0 deletions
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..e463544
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,27 @@
+FROM python:3.9-slim
+
+# Allow service to handle stops gracefully
+STOPSIGNAL SIGQUIT
+
+# Install C compiler and make
+RUN apt-get update && \
+ apt-get install -y gcc make && \
+ apt-get clean && rm -rf /var/lib/apt/lists/*
+
+# Install Poetry
+RUN pip install poetry
+
+# Copy dependencies-related files
+COPY poetry.lock .
+COPY pyproject.toml .
+
+# Install dependencies
+RUN poetry config virtualenvs.create false
+RUN poetry install --no-dev
+
+# Copy all files to container
+WORKDIR /app
+COPY . .
+
+# Start the server with uvicorn
+CMD ["gunicorn", "-w", "2", "-b", "0.0.0.0:8000", "-k", "uvicorn.workers.UvicornWorker", "backend:app"]