test69 / start.sh
zyxciss's picture
Update start.sh
c346446 verified
raw
history blame contribute delete
771 Bytes
#!/bin/sh
set -e
# --- Start the original FastAPI app manually ---
# (Because we’re overriding the image’s entrypoint, we must start the app ourselves.)
#
# If you normally run the container locally with a command like:
# uvicorn api.src.main:app --host 0.0.0.0 --port 8880
# then we use that same command here.
#
# (Adjust the command if your local startup command is different.)
echo "Starting the original app (listening on port 8880)..."
uvicorn api.src.main:app --host 0.0.0.0 --port 8880 &
orig_pid=$!
# Wait a few seconds to let the app start.
sleep 5
# --- Start socat to forward from the dynamic port to port 8880 ---
echo "Starting socat: forwarding incoming \$PORT (${PORT}) to 8880..."
exec socat TCP-LISTEN:${PORT},reuseaddr,fork TCP:127.0.0.1:8880