Skip to content

Commit 2fc1114

Browse files
committed
fix(python)!: respect $PORT variable instead of to always listen on 8000
Relate to #16
1 parent db5b4c2 commit 2fc1114

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ Generates the endpoints (or a whole app) from a mapping (SQL query -> URL)
6565
| JavaScript | <pre>$ npm install<br/>$ export DB_NAME=my-db DB_USER=my-user DB_PASSWORD=my-password<br/>$ npm start</pre> |
6666
| TypeScript | <pre>$ npm install<br/>$ npm run build<br/>$ export DB_NAME=my-db DB_USER=my-user DB_PASSWORD=my-password<br/>$ npm start</pre> |
6767
| Golang | <pre>$ export DB_NAME=my-db DB_USER=my-user DB_PASSWORD=my-password<br/>$ go run *.go</pre>or<pre>$ go build -o app<br/>$ ./app</pre> |
68-
| Python | <pre>$ pip install -r requirements.txt<br/>$ export DB_NAME=my-db DB_USER=my-user DB_PASSWORD=my-password<br/>$ uvicorn app:app</pre> |
68+
| Python | <pre>$ pip install -r requirements.txt<br/>$ export DB_NAME=my-db DB_USER=my-user DB_PASSWORD=my-password<br/>$ uvicorn app:app --port 3000</pre> |
6969

7070
---
7171
:bulb: **NOTE**

docker/docker-compose.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ services:
9696
- DB_HOST=postgres # defaults to localhost
9797
- PORT=4040 # defaults to 3000
9898
ports:
99-
- '4040:8000'
99+
- '4040:4040'
100100
depends_on:
101101
postgres:
102102
condition: service_healthy

examples/python/fastapi/postgres/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ WORKDIR /opt/app
33
COPY requirements.txt ./
44
RUN pip install --no-cache-dir --upgrade -r requirements.txt
55
COPY *.py ./
6-
CMD [ "uvicorn", "app:app", "--host", "0.0.0.0" ]
6+
CMD [ "sh", "-c", "exec uvicorn app:app --host 0.0.0.0 --port ${PORT:-3000}" ]

src/templates/Dockerfile.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
COPY requirements.txt ./
44
RUN pip install --no-cache-dir --upgrade -r requirements.txt
55
COPY *.py ./
6-
CMD [ "uvicorn", "app:app", "--host", "0.0.0.0" ]
6+
CMD [ "sh", "-c", "exec uvicorn app:app --host 0.0.0.0 --port ${PORT:-3000}" ]

0 commit comments

Comments
 (0)