forked from AshwinRachha/portfolio-ashwin-rachha
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
35 lines (24 loc) · 865 Bytes
/
Dockerfile
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
# Use an official Node.js runtime as base image for frontend
FROM node:14 as frontend
WORKDIR /frontend
COPY frontend/package*.json ./
RUN npm install
COPY frontend /frontend
RUN npm run build
# Use an official Python runtime for backend
FROM python:3.8-slim
WORKDIR /app
# Install node to serve the React app
RUN apt-get update && apt-get install -y nodejs npm && apt-get clean
# Install FastAPI dependencies
COPY backend/app/requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy the React build from the frontend stage
COPY --from=frontend /frontend/build /app/frontend/build
# Copy the backend code
COPY backend/app /app
# Expose ports (for documentation purposes)
EXPOSE 8000
EXPOSE 3000
# Use the CMD directive to start both services
CMD uvicorn main:app --host 0.0.0.0 --port 8000 & cd frontend/build && npx serve -s -l 3000