Skip to content

feat: Add configurable port via environment variable #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
## Installation
### Using docker
```bash
docker run -d --name streamdock --network host --restart unless-stopped ghcr.io/limmer55/streamdock:latest
docker run -d --name streamdock --network host -e PORT=6050 --restart unless-stopped ghcr.io/limmer55/streamdock:latest

```
### Docker Compose
Expand All @@ -32,6 +32,7 @@ services:
network_mode: host
environment:
M3U_URL: "https://iptv-org.github.io/iptv/index.m3u" # optional, can be set in settings later
PORT: "6050" # Set your desired port here, default 6050
restart: unless-stopped

```
Expand Down
5 changes: 3 additions & 2 deletions source/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ COPY . .

ENV FLASK_APP run.py
ENV FLASK_ENV production
ENV PORT=6050


EXPOSE 6050
EXPOSE ${PORT}


CMD ["gunicorn", "--bind", "0.0.0.0:6050", "run:app"]
CMD gunicorn --bind 0.0.0.0:${PORT} run:app
4 changes: 3 additions & 1 deletion source/run.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
from app import create_app
import logging
import os

log = logging.getLogger('werkzeug')
log.setLevel(logging.ERROR)

app = create_app()

if __name__ == "__main__":
app.run(host="0.0.0.0", port=6050)
port = int(os.environ.get("PORT", 6050))
app.run(host="0.0.0.0", port=port)