added docker-compose for linux

This commit is contained in:
2026-02-21 19:53:04 +02:00
parent be91231b05
commit 58b1ae9a5e
23 changed files with 761 additions and 16 deletions
+24
View File
@@ -0,0 +1,24 @@
FROM python:3.11-slim
RUN apt-get update && apt-get install -y --no-install-recommends socat && rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Install serial_bridge dependencies (server-only, no pystray/PyInstaller)
COPY serial_bridge/requirements.server.txt serial_bridge/requirements.server.txt
RUN pip install --no-cache-dir -r serial_bridge/requirements.server.txt
# Install test_writer dependencies
COPY test_comport_writer/requirements.txt test_comport_writer/requirements.txt
RUN pip install --no-cache-dir -r test_comport_writer/requirements.txt
# Copy application code
COPY serial_bridge/ serial_bridge/
COPY test_comport_writer/ test_comport_writer/
COPY serial_bridge/entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
EXPOSE 5000
ENTRYPOINT ["/entrypoint.sh"]
+2 -1
View File
@@ -214,7 +214,8 @@ def start_app():
# Start Flask app
debug = os.getenv('DEBUG', 'False').lower() == 'true'
app.run(host='127.0.0.1', port=5000, debug=debug, use_reloader=False)
host = os.getenv('HOST', '127.0.0.1')
app.run(host=host, port=5000, debug=debug, use_reloader=False)
def stop_app():
+22
View File
@@ -0,0 +1,22 @@
#!/bin/bash
set -e
echo "[socat] Creating virtual serial port pair..."
socat PTY,raw,echo=0,link=/tmp/vcom_read PTY,raw,echo=0,link=/tmp/vcom_write &
# Wait until both PTY symlinks exist
for i in $(seq 1 20); do
if [ -e /tmp/vcom_read ] && [ -e /tmp/vcom_write ]; then
echo "[socat] Virtual ports ready: /tmp/vcom_read <-> /tmp/vcom_write"
break
fi
sleep 0.5
done
echo "[test_writer] Starting test COM port writer..."
cd /app/test_comport_writer
COM_PORT=/tmp/vcom_write python test_writer.py &
echo "[serial_bridge] Starting Flask SSE server..."
cd /app/serial_bridge
exec python app.py
+4
View File
@@ -0,0 +1,4 @@
pyserial==3.5
python-dotenv==1.0.0
flask==3.1.0
flask-cors==5.0.0