# python-snap7 S7 server container for the S7 integration suite.
#
# python-snap7 wraps the upstream snap7 C library; the pip install pulls
# platform-specific binaries automatically on Debian-based images. No build
# step needed — unlike ab_server which needs compiling from source.
FROM python:3.12-slim-bookworm

LABEL org.opencontainers.image.source="https://github.com/dohertj2/lmxopcua" \
      org.opencontainers.image.description="python-snap7 S7 simulator for OtOpcUa S7 driver integration tests"

RUN pip install --no-cache-dir "python-snap7>=2.0"

WORKDIR /fixtures

# server.py is the Python shim that loads a JSON profile + starts the
# snap7.server.Server; profiles/ carries the seed definitions.
COPY server.py /fixtures/
COPY profiles/ /fixtures/

EXPOSE 1102

# -u for unbuffered stdout so `docker logs` tails the "seeded DB…"
# diagnostics without a buffer-flush delay.
CMD ["python", "-u", "/fixtures/server.py", "/fixtures/s7_1500.json", "--port", "1102"]
