diff --git a/Dockerfile b/Dockerfile index 49aeb6b..f12667f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,6 +14,7 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-ins vim \ wget \ zip \ + unzip \ && rm -rf /var/lib/apt/lists/* ADD requirements.txt requirements.txt RUN rm -f /usr/lib/python*/EXTERNALLY-MANAGED && \ diff --git a/scripts/entrypoint b/scripts/entrypoint index 34afa76..4c902ad 100755 --- a/scripts/entrypoint +++ b/scripts/entrypoint @@ -27,17 +27,27 @@ def main(): gunicorn_args = os.environ.get("GUNICORN_ARGS", "").split() gunicorn_log = '/emblem/log/gunicorn.log' subprocess.check_output(['touch', gunicorn_log]) + + # Use tee to write logs to both file and stderr + tee = subprocess.Popen(['tee', '-a', gunicorn_log], + stdin=subprocess.PIPE, + stdout=sys.stderr) + gunicorn = subprocess.Popen(['gunicorn', '-b', '127.0.0.1:28266', '-b', 'unix:/tmp/gunicorn.sock', '--log-level=info', - '--log-file=' + gunicorn_log, + '--access-logfile=-', # Log to stdout + '--error-logfile=-', # Log to stdout '-w', '8', '-t', '0', 'emblemapi.wsgi:application' - ] + gunicorn_args, cwd=os.path.join(BASE_DIR, 'api')) + ] + gunicorn_args, + cwd=os.path.join(BASE_DIR, 'api'), + stdout=tee.stdin, + stderr=subprocess.STDOUT) - procs = [nginx, gunicorn] + procs = [nginx, gunicorn, tee] atexit.register(lambda: [x.kill() for x in procs]) print("Started nginx and gunicorn, entering infinite loop")