mirror of
https://github.com/BigBodyCobain/Shadowbroker.git
synced 2026-04-25 12:06:08 +02:00
95474c3ac5
In Docker, main.py lives at /app/main.py so Path.parent.parent resolves to filesystem root /, causing PermissionError on .github and other dirs. Now detects this case and falls back to cwd. Also grants backenduser write access to /app for auto-update. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Former-commit-id: 12c8bb5816a70161d5ab5d79f9240e7eab6e6e15
39 lines
1.1 KiB
Docker
39 lines
1.1 KiB
Docker
FROM python:3.10-slim-bookworm
|
|
|
|
WORKDIR /app
|
|
|
|
# Install Node.js (for AIS WebSocket proxy) and curl (for network fallback)
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
curl \
|
|
&& curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
|
|
&& apt-get install -y --no-install-recommends nodejs \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Install Python dependencies
|
|
COPY requirements.txt .
|
|
RUN pip install --no-cache-dir -r requirements.txt \
|
|
&& playwright install --with-deps chromium
|
|
|
|
# Install Node.js dependencies (ws module for AIS WebSocket proxy)
|
|
# Copy manifests first so this layer is cached unless deps change
|
|
COPY package*.json ./
|
|
RUN npm ci --omit=dev
|
|
|
|
# Copy source code
|
|
COPY . .
|
|
|
|
# Create a non-root user for security
|
|
# Grant write access to /app so the auto-updater can extract files
|
|
RUN adduser --system --uid 1001 backenduser \
|
|
&& chown -R backenduser /app \
|
|
&& chmod -R u+w /app
|
|
|
|
# Switch to the non-root user
|
|
USER backenduser
|
|
|
|
# Expose port
|
|
EXPOSE 8000
|
|
|
|
# Start FastAPI server
|
|
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
|