-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
40 lines (28 loc) · 1.1 KB
/
Dockerfile
File metadata and controls
40 lines (28 loc) · 1.1 KB
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
30
31
32
33
34
35
36
37
38
39
40
# Stage 1: Build stage - Install dependencies
FROM python:3.10-slim as builder
WORKDIR /app
# Copy only the requirements file to leverage Docker cache
COPY backend/requirements.txt .
# Install dependencies to a user-specific directory
RUN pip install --no-cache-dir --user -r requirements.txt
# Stage 2: Final stage - Create the production image
FROM python:3.10-slim
WORKDIR /app
# Copy installed dependencies from the builder stage
COPY --from=builder /root/.local /root/.local
# Copy application code
# Copy backend and frontend into the container
COPY backend/ ./backend/
COPY frontend/ ./frontend/
# Add the local python user's bin directory to the PATH
ENV PATH=/root/.local/bin:$PATH
# Set the data directory path for the container environment
# The application will use this path to store persistent data.
ENV APP_DATA_DIR=/app/backend/data/path
# Expose the port the app runs on
EXPOSE 8000
# Set the working directory for the command
WORKDIR /app/backend
# Command to run the application
# Uvicorn is used to run the FastAPI application
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]