Skip to content

Commit 4f79d6b

Browse files
committed
bwabwabwabawbawbwa
1 parent ce2a5d8 commit 4f79d6b

22 files changed

Lines changed: 2819 additions & 771 deletions

Dockerfile

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,64 @@
11
# ---- Frontend builder ----
22
FROM node:20-slim AS frontend-builder
33
WORKDIR /frontend
4+
5+
# Copy package files for dependency installation (using lockfile for reproducible builds)
46
COPY frontend/package*.json ./
5-
RUN npm install --legacy-peer-deps
7+
COPY frontend/package-lock.json ./
8+
9+
# Install frontend dependencies with lockfile
10+
RUN npm ci --legacy-peer-deps
11+
12+
# Copy source code and build
613
COPY frontend/ .
714
RUN npm run build
815

9-
# ---- Backend image ----
10-
FROM python:3.12-slim
16+
# Clean up npm cache to reduce layer size
17+
RUN npm cache clean --force && rm -rf /frontend/node_modules
1118

19+
# ---- Backend dependencies installer ----
20+
FROM python:3.12-slim AS backend-deps
21+
22+
# Set environment variables
1223
ENV PYTHONUNBUFFERED=1 \
13-
PIP_NO_CACHE_DIR=1
24+
PIP_NO_CACHE_DIR=1 \
25+
PIP_DISABLE_PIP_VERSION_CHECK=1
1426

1527
WORKDIR /app
1628

29+
# Install build dependencies for Python packages that need compilation
1730
RUN apt-get update && apt-get install -y --no-install-recommends \
1831
build-essential \
1932
&& rm -rf /var/lib/apt/lists/*
2033

34+
# Copy requirements file and install Python dependencies
2135
COPY requirements.txt .
2236
RUN pip install --upgrade pip && pip install -r requirements.txt
2337

38+
# Remove build dependencies after installing Python packages
39+
RUN apt-get remove -y build-essential && \
40+
apt-get autoremove -y && \
41+
apt-get clean && \
42+
rm -rf /var/lib/apt/lists/*
43+
44+
# ---- Production image ----
45+
FROM python:3.12-slim
46+
47+
# Set environment variables
48+
ENV PYTHONUNBUFFERED=1 \
49+
PIP_NO_CACHE_DIR=1 \
50+
PIP_DISABLE_PIP_VERSION_CHECK=1
51+
52+
WORKDIR /app
53+
54+
# Copy installed Python dependencies from the backend-deps stage
55+
COPY --from=backend-deps /usr/local/lib/python3.12/site-packages /usr/local/lib/python3.12/site-packages
56+
COPY --from=backend-deps /usr/local/bin /usr/local/bin
57+
58+
# Copy application code
2459
COPY . .
60+
61+
# Copy built frontend assets from builder stage
2562
COPY --from=frontend-builder /frontend/dist ./frontend/dist
2663

2764
EXPOSE 8000

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ Run the API (after building the frontend):
5858
uvicorn app.main:app --host 0.0.0.0 --port 8000 --workers 2 --proxy-headers
5959
```
6060

61-
The React UI lives at `/app` (with routes for the landing page, API guide, and admin dashboard). Static assets for the SPA are served from `/frontend`.
61+
The React UI lives at `/app` (with routes for the landing page, API guide, and admin dashboard at `/app/admin`). Static assets for the SPA are served from `/frontend`.
6262

6363
### Frontend (React)
6464

@@ -137,7 +137,9 @@ For permanent file uploads, you need to provide a valid API key in one of these
137137
Set the `API_KEY` environment variable to configure the server's expected API key.
138138

139139
### Admin Dashboard
140-
- Visit `/admin` with the header `X-Admin-Password: <ADMIN_PASSWORD>` (or include `password` in the query/form) to view uploads, downloads, cleanup counts, recent files, and trigger per-file or bulk deletions.
140+
- Visit `/app/admin/login` to access the modern React-based admin dashboard.
141+
- The new admin interface provides a better user experience with metrics, file management, and bulk operations.
142+
- Alternatively, you can still use the API endpoints directly with the header `X-Admin-Password: <ADMIN_PASSWORD>` for programmatic access.
141143
- After three failed attempts the admin login is locked; each lock adds `ADMIN_LOCK_STEP_SECONDS` (default 5 minutes) to the wait time.
142144

143145
## Cleaning Expired Files

0 commit comments

Comments
 (0)