Update start.sh
Browse files
start.sh
CHANGED
|
@@ -1,21 +1,21 @@
|
|
| 1 |
#!/bin/sh
|
| 2 |
set -e
|
| 3 |
|
| 4 |
-
#
|
| 5 |
-
|
| 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 |
-
#
|
| 14 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
-
#
|
| 17 |
sleep 5
|
| 18 |
|
| 19 |
-
|
| 20 |
-
|
| 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
|