zyxciss commited on
Commit
c346446
·
verified ·
1 Parent(s): b960254

Update start.sh

Browse files
Files changed (1) hide show
  1. start.sh +13 -13
start.sh CHANGED
@@ -1,21 +1,21 @@
1
  #!/bin/sh
2
  set -e
3
 
4
- # (Optional) Print diagnostic info
5
- echo "Starting the original app (listening on port 8880)..."
6
-
7
- # Start the original application in the background.
8
- # We assume the prebuilt image’s default command starts the server on port 8880.
9
- # If the image already starts the server as its ENTRYPOINT, you might not need to start it again.
10
- # In many cases, the base image has an ENTRYPOINT that runs the app.
11
- # If that’s the case, then you can omit starting it here.
12
  #
13
- # Uncomment the following line if you need to start it explicitly:
14
- # uvicorn api.src.main:app --host 0.0.0.0 --port 8880 &
 
 
 
 
 
 
15
 
16
- # Give the app a few seconds to start
17
  sleep 5
18
 
19
- echo "Starting socat: forwarding incoming \$PORT ($PORT) to 8880..."
20
- # Forward incoming traffic on $PORT to localhost:8880
21
  exec socat TCP-LISTEN:${PORT},reuseaddr,fork TCP:127.0.0.1:8880
 
1
  #!/bin/sh
2
  set -e
3
 
4
+ # --- Start the original FastAPI app manually ---
5
+ # (Because we’re overriding the image’s entrypoint, we must start the app ourselves.)
 
 
 
 
 
 
6
  #
7
+ # If you normally run the container locally with a command like:
8
+ # uvicorn api.src.main:app --host 0.0.0.0 --port 8880
9
+ # then we use that same command here.
10
+ #
11
+ # (Adjust the command if your local startup command is different.)
12
+ echo "Starting the original app (listening on port 8880)..."
13
+ uvicorn api.src.main:app --host 0.0.0.0 --port 8880 &
14
+ orig_pid=$!
15
 
16
+ # Wait a few seconds to let the app start.
17
  sleep 5
18
 
19
+ # --- Start socat to forward from the dynamic port to port 8880 ---
20
+ echo "Starting socat: forwarding incoming \$PORT (${PORT}) to 8880..."
21
  exec socat TCP-LISTEN:${PORT},reuseaddr,fork TCP:127.0.0.1:8880