-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
116 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
### 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"] | ||
|
||
|