-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile.backend
37 lines (26 loc) · 961 Bytes
/
Dockerfile.backend
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
# -------- Step 1: Base Python image for FastAPI Development --------
FROM python:3.11-slim AS backend-dev
WORKDIR /app
# Copy backend-specific files
COPY ./backend/requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy the backend code
COPY ./backend .
# -------- Step 2: Final setup for running dev environments --------
# Using the base Python image
FROM python:3.11-slim
WORKDIR /app
ENV PYTHONPATH=/app
# Copy FastAPI backend
COPY --from=backend-dev /app /app
# Install Node.js and NPM for frontend dev
RUN apt-get update && apt-get install -y nodejs npm
# Copy frontend files
COPY --from=frontend-dev /app /app
# Install any missing Python packages (if necessary)
COPY ./backend/requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Expose FastAPI and frontend ports
EXPOSE 8000
# Command to start FastAPI development server
CMD ["uvicorn", "main:app", "--reload", "--host", "0.0.0.0", "--port", "8000"]