FROM debian:trixie-20260803-slim@sha256:3a39a0592364683e6bab97937b72cad5a8fa6dcbbee90edb3bb48c7f8e94f258 AS default

RUN --mount=type=bind,source=repro-sources-list.sh,target=/sbin/repro-sources-list.sh \
    /sbin/repro-sources-list.sh

# install everything we need
RUN set -x && \
  apt-get update -y && \
  apt-get install -y --no-install-recommends socat libsdl2-dev

# Add a user to run the services under
RUN mkdir -p /chal && \
    useradd -m user -d /chal/user/ && \
    chmod 755 /chal/user

# copy over all the files and add the flag
COPY chip /chal/user/

# run the challenge
EXPOSE 1024
USER user
ENTRYPOINT ["socat", "tcp-l:1024,reuseaddr,fork", "EXEC:'/chal/user/chip'"]
