-
Notifications
You must be signed in to change notification settings - Fork 0
/
spa_docker_attempt
62 lines (40 loc) · 1.24 KB
/
spa_docker_attempt
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
### An attempt at serving the frontend and backend from the same container
# Build for Vite frontend
FROM node:23.0.0-alpine AS frontend-builder
WORKDIR /app/frontend
# Copy package.json and package-lock.json to install dependencies
COPY /frontend/package*.json ./
# Install dependencies
RUN npm install
# Copy the rest of the application code
COPY /frontend/. .
# Build the application for production
RUN npm run build
#EXPOSE 8080
#CMD ["npm", "run", "start", "--", "--host"]
# Build for FastAPI backend
FROM python:3.13-slim
WORKDIR /app
# Install gcc and other necessary tools
RUN apt-get update && apt-get install -y \
gcc \
libffi-dev \
&& rm -rf /var/lib/apt/lists/*
# Install nmap
RUN apt-get update && \
apt-get install -y nmap && \
apt-get clean
# Install ping
RUN apt-get update && \
apt-get install -y iputils-ping && \
apt-get clean
COPY backend/requirements.txt requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
# Copy the rest of the application code
COPY . .
EXPOSE 8000
# Run as root for nmap calls.
USER root
# Copy frontend build to backend
COPY --from=frontend-builder /app/frontend/dist /app/frontend/dist
CMD ["uvicorn", "backend.main:app", "--host", "0.0.0.0", "--port", "8000"]