stage18: docker hardening — non-root user, read-only FS, no-new-privileges, health-check fix, .dockerignore
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# ============================================================
|
||||
# NSCT — Neutral Search Crawler Tool
|
||||
# Multi-stage Docker build, non-root user
|
||||
# Hardened multi-stage Docker build, non-root user, read-only FS
|
||||
# ============================================================
|
||||
|
||||
# ---------- Build stage ----------
|
||||
@@ -29,9 +29,14 @@ FROM python:3.12-slim AS runtime
|
||||
ENV PYTHONDONTWRITEBYTECODE=1 \
|
||||
PYTHONUNBUFFERED=1
|
||||
|
||||
# Minimal packages: curl for health-check, shared libs
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
curl libpq5 \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Non-root user
|
||||
RUN groupadd --gid 1000 nsct && \
|
||||
useradd --uid 1000 --gid nsct --shell /bin/bash --create-home nsct
|
||||
useradd --uid 1000 --gid nsct --shell /bin/sh --create-home nsct
|
||||
|
||||
RUN mkdir -p /app/data && chown -R nsct:nsct /app/data
|
||||
|
||||
|
||||
Reference in New Issue
Block a user