Add Dockerfile and docker-compose.yml for deployment
This commit is contained in:
27
Dockerfile
Normal file
27
Dockerfile
Normal file
@@ -0,0 +1,27 @@
|
||||
# Use Python 3.11 slim image
|
||||
FROM python:3.11-slim
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /app
|
||||
|
||||
# Install system dependencies if needed
|
||||
RUN apt-get update && apt-get install -y \
|
||||
gcc \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Copy requirements and install Python dependencies
|
||||
COPY requirements.txt .
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
# Copy the source code
|
||||
COPY src/ ./src/
|
||||
COPY data/ ./data/
|
||||
|
||||
# Create data directory if it doesn't exist
|
||||
RUN mkdir -p data
|
||||
|
||||
# Expose port
|
||||
EXPOSE $APP_PORT
|
||||
|
||||
# Run the application
|
||||
CMD ["python", "-m", "uvicorn", "src.main:app", "--host", "0.0.0.0", "--port", "$APP_PORT"]
|
||||
Reference in New Issue
Block a user