diff --git a/Dockerfile b/Dockerfile index 3e366b0..18116ed 100755 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM registry.access.redhat.com/ubi8 +FROM registry.access.redhat.com/ubi8:8.3 WORKDIR /app @@ -17,4 +17,8 @@ USER 1001 COPY . /app ENV FLASK_APP=server/__init__.py -CMD ["python3", "manage.py", "start", "0.0.0.0:3000"] +ENV PORT 3000 + +EXPOSE 3000 + +CMD ["python3", "manage.py", "start"] diff --git a/README.md b/README.md index d7e0fe2..e7f775f 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,13 @@ Running Flask applications has been simplified with a `manage.py` file to avoid pipenv install ``` -To run your application locally: +Then, activate this app's virtualenv: + +```bash +pipenv shell +``` + +To run your application locally, run this inside the virtualenv: ```bash python manage.py start diff --git a/manage.py b/manage.py index 7c79268..2cc23fd 100755 --- a/manage.py +++ b/manage.py @@ -1,9 +1,12 @@ import os, sys, argparse, subprocess, signal +# Tip from: +# https://github.com/dpgaspar/Flask-AppBuilder/issues/733#issuecomment-379009480 +PORT = int(os.environ.get("PORT", 3000)) + # Project defaults FLASK_APP = 'server/__init__.py' -DEFAULT_IP = '0.0.0.0:3000' - +DEFAULT_IP = '0.0.0.0:' + str(PORT) class Command: def __init__(self, name, descr, runcmd, env={}): @@ -99,7 +102,7 @@ def availableCommands(self): formatter_class=argparse.RawDescriptionHelpFormatter) parser.add_argument("subcommand", help="subcommand to run (see list above)") parser.add_argument("ipaddress", nargs='?', default=DEFAULT_IP, - help="address and port to run on (i.e. {0})".format(DEFAULT_IP)) + help="address and port to run on (i.e. 0.0.0.0:3000)") def livereload_check():