Update dockerfile to use UV

Change backend context from . to ./backend in docker-compose.
This is necessary for copying the pyproject.toml and uv.lock files from project root level
This commit is contained in:
Orfeo Terkuci
2026-03-22 15:39:23 +01:00
parent e7f96499b9
commit 1034d95145
2 changed files with 19 additions and 8 deletions
+17 -7
View File
@@ -9,19 +9,29 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
&& 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 UV for Python dependency management
ADD https://astral.sh/uv/install.sh /uv-installer.sh
RUN sh /uv-installer.sh && rm /uv-installer.sh
ENV PATH="/root/.local/bin/:$PATH"
# Set environment variable for UV to install dependencies in the system Python environment
# By default UV creates a new venv and installs dependencies there
ENV UV_PROJECT_ENVIRONMENT=/usr/local
# Copy pyproject.toml from root for dependency management
COPY pyproject.toml .
# Copy lock file for reproducible builds
COPY uv.lock .
# Install Python dependencies using UV (this will use the lock file for reproducibility)
RUN uv sync --frozen
RUN uv run 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 ./
COPY backend/package*.json ./
RUN npm ci --omit=dev
# Copy source code
COPY . .
COPY backend/ .
# 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 \
+2 -1
View File
@@ -1,7 +1,8 @@
services:
backend:
build:
context: ./backend
context: .
dockerfile: ./backend/Dockerfile
container_name: shadowbroker-backend
ports:
- "8000:8000"