-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathDockerfile
More file actions
29 lines (22 loc) · 737 Bytes
/
Dockerfile
File metadata and controls
29 lines (22 loc) · 737 Bytes
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
FROM python:3.9-slim
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
ENV UVICORN_RELOAD false # Default to false for Docker environments
WORKDIR /app
# Create a virtual environment
RUN python -m venv /app/venv
# Add venv to PATH
ENV PATH="/app/venv/bin:$PATH"
# Copy requirements first to leverage Docker cache
COPY requirements.txt .
# Activate virtual environment and install requirements
RUN pip install --no-cache-dir -r requirements.txt
# Copy application code
# Copy only necessary files for the application to run
COPY ./src ./src
COPY main.py .
# Make port 5712 available (aligns with config.json and main.py)
EXPOSE 5712
# Run main.py when the container launches
CMD ["python", "main.py"]