From f6c27aae85665b451d716f77e8689b36fe623943 Mon Sep 17 00:00:00 2001 From: Zhichao Li Date: Wed, 16 Apr 2025 21:56:35 +0000 Subject: [PATCH] Dockerized workspace --- .dockerignore | 13 +++++++++++++ Dockerfile | 20 ++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..e935792 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,13 @@ +# Exclude Python cache and virtual environments +__pycache__/ +*.pyc + +# Exclude git +.git + +# Exclude IDE/editor config +*.vscode +*.idea + +# Exclude documentation files +*.md \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..ed2f0b5 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,20 @@ +# Use the official Python base image +FROM python:3.11-slim + +# Set the working directory in the container +WORKDIR /app + +# Copy only the requirements file to leverage Docker cache +COPY src/requirements.txt ./ + +# Install the dependencies +RUN pip install --no-cache-dir -r requirements.txt + +# Copy the entire app directory into the container +COPY src/app ./app + +# Expose the port FastAPI will use +EXPOSE 8080 + +# Correct Command to run when the container starts +CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8080"] \ No newline at end of file