File size: 771 Bytes
5067a19
 
 
c346446
 
5067a19
c346446
 
 
 
 
 
 
 
5067a19
c346446
5067a19
 
c346446
 
5067a19
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/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