FROM python:3.11-slim-bookworm

RUN apt-get update && apt-get install -y socat

COPY . /app/
WORKDIR /app
RUN chmod 444 /app/*
RUN chmod 555 /app/d8

RUN addgroup --gid 1001 nonroot && \
    adduser --uid 1001 --gid 1001 --disabled-password --gecos "" nonroot

USER 1001

EXPOSE 1337
CMD ["socat", "TCP-LISTEN:1337,reuseaddr,fork", "EXEC:'timeout -s KILL 5m python3 server.py'"]
