Skip to content

Commit 2bc228f

Browse files
committed
added docker files
1 parent 3903dcc commit 2bc228f

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.venv
2+
__pycache__

Dockerfile

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Use the official Python image
2+
FROM python:3.10-slim
3+
4+
# Set environment variables to prevent Python from writing .pyc files and to buffer stdout and stderr
5+
ENV PYTHONDONTWRITEBYTECODE=1
6+
ENV PYTHONUNBUFFERED=1
7+
8+
# Create and set the working directory
9+
WORKDIR /app
10+
11+
# Install system dependencies
12+
RUN apt-get update && apt-get install -y \
13+
gcc \
14+
libpq-dev \
15+
--no-install-recommends && \
16+
apt-get clean && \
17+
rm -rf /var/lib/apt/lists/*
18+
19+
# Copy the requirements file and install dependencies
20+
COPY requirements.txt .
21+
RUN pip install --no-cache-dir --upgrade pip && \
22+
pip install --no-cache-dir -r requirements.txt
23+
24+
# Copy the application files to the working directory
25+
COPY . .
26+
27+
# Expose the port
28+
EXPOSE 8000
29+
30+
# Run the application
31+
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]

0 commit comments

Comments
 (0)