From db8290c4b9825eb4098223096040a1a66b21f510 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Ram=C3=ADrez?= Date: Fri, 10 May 2019 16:49:49 +0400 Subject: [PATCH 1/3] :fire: Implement prestart.sh in parent image --- python2.7-alpine3.7/Dockerfile | 7 ++----- python2.7-alpine3.7/start.sh | 15 --------------- python2.7-alpine3.8/Dockerfile | 7 ++----- python2.7-alpine3.8/start.sh | 15 --------------- python2.7/Dockerfile | 4 ---- python2.7/start.sh | 15 --------------- python3.5/Dockerfile | 7 ++----- python3.5/start.sh | 15 --------------- python3.6-alpine3.7/Dockerfile | 7 ++----- python3.6-alpine3.7/start.sh | 15 --------------- python3.6-alpine3.8/Dockerfile | 7 ++----- python3.6-alpine3.8/start.sh | 15 --------------- python3.6/Dockerfile | 7 ++----- python3.6/start.sh | 15 --------------- python3.7-alpine3.7/Dockerfile | 7 ++----- python3.7-alpine3.7/start.sh | 15 --------------- python3.7-alpine3.8/Dockerfile | 7 ++----- python3.7-alpine3.8/start.sh | 15 --------------- python3.7/Dockerfile | 7 ++----- python3.7/start.sh | 15 --------------- 20 files changed, 18 insertions(+), 199 deletions(-) delete mode 100644 python2.7-alpine3.7/start.sh delete mode 100644 python2.7-alpine3.8/start.sh delete mode 100644 python2.7/start.sh delete mode 100644 python3.5/start.sh delete mode 100644 python3.6-alpine3.7/start.sh delete mode 100644 python3.6-alpine3.8/start.sh delete mode 100644 python3.6/start.sh delete mode 100644 python3.7-alpine3.7/start.sh delete mode 100644 python3.7-alpine3.8/start.sh delete mode 100644 python3.7/start.sh diff --git a/python2.7-alpine3.7/Dockerfile b/python2.7-alpine3.7/Dockerfile index 8f0572fb..4ea2bebd 100644 --- a/python2.7-alpine3.7/Dockerfile +++ b/python2.7-alpine3.7/Dockerfile @@ -21,10 +21,6 @@ WORKDIR /app # Make /app/* available to be imported by Python globally to better support several use cases like Alembic migrations. ENV PYTHONPATH=/app -# Copy start.sh script that will check for a /app/prestart.sh script and run it before starting the app -COPY start.sh /start.sh -RUN chmod +x /start.sh - # Move the base entrypoint to reuse it RUN mv /entrypoint.sh /uwsgi-nginx-entrypoint.sh # Copy the entrypoint that will generate Nginx additional configs @@ -33,6 +29,7 @@ RUN chmod +x /entrypoint.sh ENTRYPOINT ["/entrypoint.sh"] -# Run the start script, it will check for an /app/prestart.sh script (e.g. for migrations) +# Run the start script provided by the parent image tiangolo/uwsgi-nginx. +# It will check for an /app/prestart.sh script (e.g. for migrations) # And then will start Supervisor, which in turn will start Nginx and uWSGI CMD ["/start.sh"] diff --git a/python2.7-alpine3.7/start.sh b/python2.7-alpine3.7/start.sh deleted file mode 100644 index 8626c151..00000000 --- a/python2.7-alpine3.7/start.sh +++ /dev/null @@ -1,15 +0,0 @@ -#! /usr/bin/env sh -set -e - -# If there's a prestart.sh script in the /app directory, run it before starting -PRE_START_PATH=/app/prestart.sh -echo "Checking for script in $PRE_START_PATH" -if [ -f $PRE_START_PATH ] ; then - echo "Running script $PRE_START_PATH" - source $PRE_START_PATH -else - echo "There is no script $PRE_START_PATH" -fi - -# Start Supervisor, with Nginx and uWSGI -exec /usr/bin/supervisord diff --git a/python2.7-alpine3.8/Dockerfile b/python2.7-alpine3.8/Dockerfile index c69a956b..bd73e2ff 100644 --- a/python2.7-alpine3.8/Dockerfile +++ b/python2.7-alpine3.8/Dockerfile @@ -21,10 +21,6 @@ WORKDIR /app # Make /app/* available to be imported by Python globally to better support several use cases like Alembic migrations. ENV PYTHONPATH=/app -# Copy start.sh script that will check for a /app/prestart.sh script and run it before starting the app -COPY start.sh /start.sh -RUN chmod +x /start.sh - # Move the base entrypoint to reuse it RUN mv /entrypoint.sh /uwsgi-nginx-entrypoint.sh # Copy the entrypoint that will generate Nginx additional configs @@ -33,6 +29,7 @@ RUN chmod +x /entrypoint.sh ENTRYPOINT ["/entrypoint.sh"] -# Run the start script, it will check for an /app/prestart.sh script (e.g. for migrations) +# Run the start script provided by the parent image tiangolo/uwsgi-nginx. +# It will check for an /app/prestart.sh script (e.g. for migrations) # And then will start Supervisor, which in turn will start Nginx and uWSGI CMD ["/start.sh"] diff --git a/python2.7-alpine3.8/start.sh b/python2.7-alpine3.8/start.sh deleted file mode 100644 index 8626c151..00000000 --- a/python2.7-alpine3.8/start.sh +++ /dev/null @@ -1,15 +0,0 @@ -#! /usr/bin/env sh -set -e - -# If there's a prestart.sh script in the /app directory, run it before starting -PRE_START_PATH=/app/prestart.sh -echo "Checking for script in $PRE_START_PATH" -if [ -f $PRE_START_PATH ] ; then - echo "Running script $PRE_START_PATH" - source $PRE_START_PATH -else - echo "There is no script $PRE_START_PATH" -fi - -# Start Supervisor, with Nginx and uWSGI -exec /usr/bin/supervisord diff --git a/python2.7/Dockerfile b/python2.7/Dockerfile index cf2c3094..15a42656 100644 --- a/python2.7/Dockerfile +++ b/python2.7/Dockerfile @@ -21,10 +21,6 @@ WORKDIR /app # Make /app/* available to be imported by Python globally to better support several use cases like Alembic migrations. ENV PYTHONPATH=/app -# Copy start.sh script that will check for a /app/prestart.sh script and run it before starting the app -COPY start.sh /start.sh -RUN chmod +x /start.sh - # Move the base entrypoint to reuse it RUN mv /entrypoint.sh /uwsgi-nginx-entrypoint.sh # Copy the entrypoint that will generate Nginx additional configs diff --git a/python2.7/start.sh b/python2.7/start.sh deleted file mode 100644 index 81580305..00000000 --- a/python2.7/start.sh +++ /dev/null @@ -1,15 +0,0 @@ -#! /usr/bin/env bash -set -e - -# If there's a prestart.sh script in the /app directory, run it before starting -PRE_START_PATH=/app/prestart.sh -echo "Checking for script in $PRE_START_PATH" -if [ -f $PRE_START_PATH ] ; then - echo "Running script $PRE_START_PATH" - source $PRE_START_PATH -else - echo "There is no script $PRE_START_PATH" -fi - -# Start Supervisor, with Nginx and uWSGI -exec /usr/bin/supervisord diff --git a/python3.5/Dockerfile b/python3.5/Dockerfile index d5e790c9..4d7e3b6c 100644 --- a/python3.5/Dockerfile +++ b/python3.5/Dockerfile @@ -21,10 +21,6 @@ WORKDIR /app # Make /app/* available to be imported by Python globally to better support several use cases like Alembic migrations. ENV PYTHONPATH=/app -# Copy start.sh script that will check for a /app/prestart.sh script and run it before starting the app -COPY start.sh /start.sh -RUN chmod +x /start.sh - # Move the base entrypoint to reuse it RUN mv /entrypoint.sh /uwsgi-nginx-entrypoint.sh # Copy the entrypoint that will generate Nginx additional configs @@ -33,6 +29,7 @@ RUN chmod +x /entrypoint.sh ENTRYPOINT ["/entrypoint.sh"] -# Run the start script, it will check for an /app/prestart.sh script (e.g. for migrations) +# Run the start script provided by the parent image tiangolo/uwsgi-nginx. +# It will check for an /app/prestart.sh script (e.g. for migrations) # And then will start Supervisor, which in turn will start Nginx and uWSGI CMD ["/start.sh"] diff --git a/python3.5/start.sh b/python3.5/start.sh deleted file mode 100644 index 81580305..00000000 --- a/python3.5/start.sh +++ /dev/null @@ -1,15 +0,0 @@ -#! /usr/bin/env bash -set -e - -# If there's a prestart.sh script in the /app directory, run it before starting -PRE_START_PATH=/app/prestart.sh -echo "Checking for script in $PRE_START_PATH" -if [ -f $PRE_START_PATH ] ; then - echo "Running script $PRE_START_PATH" - source $PRE_START_PATH -else - echo "There is no script $PRE_START_PATH" -fi - -# Start Supervisor, with Nginx and uWSGI -exec /usr/bin/supervisord diff --git a/python3.6-alpine3.7/Dockerfile b/python3.6-alpine3.7/Dockerfile index 69d55f36..e15cf22e 100644 --- a/python3.6-alpine3.7/Dockerfile +++ b/python3.6-alpine3.7/Dockerfile @@ -21,10 +21,6 @@ WORKDIR /app # Make /app/* available to be imported by Python globally to better support several use cases like Alembic migrations. ENV PYTHONPATH=/app -# Copy start.sh script that will check for a /app/prestart.sh script and run it before starting the app -COPY start.sh /start.sh -RUN chmod +x /start.sh - # Move the base entrypoint to reuse it RUN mv /entrypoint.sh /uwsgi-nginx-entrypoint.sh # Copy the entrypoint that will generate Nginx additional configs @@ -33,6 +29,7 @@ RUN chmod +x /entrypoint.sh ENTRYPOINT ["/entrypoint.sh"] -# Run the start script, it will check for an /app/prestart.sh script (e.g. for migrations) +# Run the start script provided by the parent image tiangolo/uwsgi-nginx. +# It will check for an /app/prestart.sh script (e.g. for migrations) # And then will start Supervisor, which in turn will start Nginx and uWSGI CMD ["/start.sh"] diff --git a/python3.6-alpine3.7/start.sh b/python3.6-alpine3.7/start.sh deleted file mode 100644 index 8626c151..00000000 --- a/python3.6-alpine3.7/start.sh +++ /dev/null @@ -1,15 +0,0 @@ -#! /usr/bin/env sh -set -e - -# If there's a prestart.sh script in the /app directory, run it before starting -PRE_START_PATH=/app/prestart.sh -echo "Checking for script in $PRE_START_PATH" -if [ -f $PRE_START_PATH ] ; then - echo "Running script $PRE_START_PATH" - source $PRE_START_PATH -else - echo "There is no script $PRE_START_PATH" -fi - -# Start Supervisor, with Nginx and uWSGI -exec /usr/bin/supervisord diff --git a/python3.6-alpine3.8/Dockerfile b/python3.6-alpine3.8/Dockerfile index 09ce3ecc..2d155747 100644 --- a/python3.6-alpine3.8/Dockerfile +++ b/python3.6-alpine3.8/Dockerfile @@ -21,10 +21,6 @@ WORKDIR /app # Make /app/* available to be imported by Python globally to better support several use cases like Alembic migrations. ENV PYTHONPATH=/app -# Copy start.sh script that will check for a /app/prestart.sh script and run it before starting the app -COPY start.sh /start.sh -RUN chmod +x /start.sh - # Move the base entrypoint to reuse it RUN mv /entrypoint.sh /uwsgi-nginx-entrypoint.sh # Copy the entrypoint that will generate Nginx additional configs @@ -33,6 +29,7 @@ RUN chmod +x /entrypoint.sh ENTRYPOINT ["/entrypoint.sh"] -# Run the start script, it will check for an /app/prestart.sh script (e.g. for migrations) +# Run the start script provided by the parent image tiangolo/uwsgi-nginx. +# It will check for an /app/prestart.sh script (e.g. for migrations) # And then will start Supervisor, which in turn will start Nginx and uWSGI CMD ["/start.sh"] diff --git a/python3.6-alpine3.8/start.sh b/python3.6-alpine3.8/start.sh deleted file mode 100644 index 8626c151..00000000 --- a/python3.6-alpine3.8/start.sh +++ /dev/null @@ -1,15 +0,0 @@ -#! /usr/bin/env sh -set -e - -# If there's a prestart.sh script in the /app directory, run it before starting -PRE_START_PATH=/app/prestart.sh -echo "Checking for script in $PRE_START_PATH" -if [ -f $PRE_START_PATH ] ; then - echo "Running script $PRE_START_PATH" - source $PRE_START_PATH -else - echo "There is no script $PRE_START_PATH" -fi - -# Start Supervisor, with Nginx and uWSGI -exec /usr/bin/supervisord diff --git a/python3.6/Dockerfile b/python3.6/Dockerfile index 40a46138..0f3b1e7c 100644 --- a/python3.6/Dockerfile +++ b/python3.6/Dockerfile @@ -21,10 +21,6 @@ WORKDIR /app # Make /app/* available to be imported by Python globally to better support several use cases like Alembic migrations. ENV PYTHONPATH=/app -# Copy start.sh script that will check for a /app/prestart.sh script and run it before starting the app -COPY start.sh /start.sh -RUN chmod +x /start.sh - # Move the base entrypoint to reuse it RUN mv /entrypoint.sh /uwsgi-nginx-entrypoint.sh # Copy the entrypoint that will generate Nginx additional configs @@ -33,6 +29,7 @@ RUN chmod +x /entrypoint.sh ENTRYPOINT ["/entrypoint.sh"] -# Run the start script, it will check for an /app/prestart.sh script (e.g. for migrations) +# Run the start script provided by the parent image tiangolo/uwsgi-nginx. +# It will check for an /app/prestart.sh script (e.g. for migrations) # And then will start Supervisor, which in turn will start Nginx and uWSGI CMD ["/start.sh"] diff --git a/python3.6/start.sh b/python3.6/start.sh deleted file mode 100644 index 81580305..00000000 --- a/python3.6/start.sh +++ /dev/null @@ -1,15 +0,0 @@ -#! /usr/bin/env bash -set -e - -# If there's a prestart.sh script in the /app directory, run it before starting -PRE_START_PATH=/app/prestart.sh -echo "Checking for script in $PRE_START_PATH" -if [ -f $PRE_START_PATH ] ; then - echo "Running script $PRE_START_PATH" - source $PRE_START_PATH -else - echo "There is no script $PRE_START_PATH" -fi - -# Start Supervisor, with Nginx and uWSGI -exec /usr/bin/supervisord diff --git a/python3.7-alpine3.7/Dockerfile b/python3.7-alpine3.7/Dockerfile index 4f5b0f2f..c734f455 100644 --- a/python3.7-alpine3.7/Dockerfile +++ b/python3.7-alpine3.7/Dockerfile @@ -21,10 +21,6 @@ WORKDIR /app # Make /app/* available to be imported by Python globally to better support several use cases like Alembic migrations. ENV PYTHONPATH=/app -# Copy start.sh script that will check for a /app/prestart.sh script and run it before starting the app -COPY start.sh /start.sh -RUN chmod +x /start.sh - # Move the base entrypoint to reuse it RUN mv /entrypoint.sh /uwsgi-nginx-entrypoint.sh # Copy the entrypoint that will generate Nginx additional configs @@ -33,6 +29,7 @@ RUN chmod +x /entrypoint.sh ENTRYPOINT ["/entrypoint.sh"] -# Run the start script, it will check for an /app/prestart.sh script (e.g. for migrations) +# Run the start script provided by the parent image tiangolo/uwsgi-nginx. +# It will check for an /app/prestart.sh script (e.g. for migrations) # And then will start Supervisor, which in turn will start Nginx and uWSGI CMD ["/start.sh"] diff --git a/python3.7-alpine3.7/start.sh b/python3.7-alpine3.7/start.sh deleted file mode 100644 index 8626c151..00000000 --- a/python3.7-alpine3.7/start.sh +++ /dev/null @@ -1,15 +0,0 @@ -#! /usr/bin/env sh -set -e - -# If there's a prestart.sh script in the /app directory, run it before starting -PRE_START_PATH=/app/prestart.sh -echo "Checking for script in $PRE_START_PATH" -if [ -f $PRE_START_PATH ] ; then - echo "Running script $PRE_START_PATH" - source $PRE_START_PATH -else - echo "There is no script $PRE_START_PATH" -fi - -# Start Supervisor, with Nginx and uWSGI -exec /usr/bin/supervisord diff --git a/python3.7-alpine3.8/Dockerfile b/python3.7-alpine3.8/Dockerfile index 7444b9e0..509d8306 100644 --- a/python3.7-alpine3.8/Dockerfile +++ b/python3.7-alpine3.8/Dockerfile @@ -21,10 +21,6 @@ WORKDIR /app # Make /app/* available to be imported by Python globally to better support several use cases like Alembic migrations. ENV PYTHONPATH=/app -# Copy start.sh script that will check for a /app/prestart.sh script and run it before starting the app -COPY start.sh /start.sh -RUN chmod +x /start.sh - # Move the base entrypoint to reuse it RUN mv /entrypoint.sh /uwsgi-nginx-entrypoint.sh # Copy the entrypoint that will generate Nginx additional configs @@ -33,6 +29,7 @@ RUN chmod +x /entrypoint.sh ENTRYPOINT ["/entrypoint.sh"] -# Run the start script, it will check for an /app/prestart.sh script (e.g. for migrations) +# Run the start script provided by the parent image tiangolo/uwsgi-nginx. +# It will check for an /app/prestart.sh script (e.g. for migrations) # And then will start Supervisor, which in turn will start Nginx and uWSGI CMD ["/start.sh"] diff --git a/python3.7-alpine3.8/start.sh b/python3.7-alpine3.8/start.sh deleted file mode 100644 index 8626c151..00000000 --- a/python3.7-alpine3.8/start.sh +++ /dev/null @@ -1,15 +0,0 @@ -#! /usr/bin/env sh -set -e - -# If there's a prestart.sh script in the /app directory, run it before starting -PRE_START_PATH=/app/prestart.sh -echo "Checking for script in $PRE_START_PATH" -if [ -f $PRE_START_PATH ] ; then - echo "Running script $PRE_START_PATH" - source $PRE_START_PATH -else - echo "There is no script $PRE_START_PATH" -fi - -# Start Supervisor, with Nginx and uWSGI -exec /usr/bin/supervisord diff --git a/python3.7/Dockerfile b/python3.7/Dockerfile index 18f7cb52..3b6345af 100644 --- a/python3.7/Dockerfile +++ b/python3.7/Dockerfile @@ -21,10 +21,6 @@ WORKDIR /app # Make /app/* available to be imported by Python globally to better support several use cases like Alembic migrations. ENV PYTHONPATH=/app -# Copy start.sh script that will check for a /app/prestart.sh script and run it before starting the app -COPY start.sh /start.sh -RUN chmod +x /start.sh - # Move the base entrypoint to reuse it RUN mv /entrypoint.sh /uwsgi-nginx-entrypoint.sh # Copy the entrypoint that will generate Nginx additional configs @@ -33,6 +29,7 @@ RUN chmod +x /entrypoint.sh ENTRYPOINT ["/entrypoint.sh"] -# Run the start script, it will check for an /app/prestart.sh script (e.g. for migrations) +# Run the start script provided by the parent image tiangolo/uwsgi-nginx. +# It will check for an /app/prestart.sh script (e.g. for migrations) # And then will start Supervisor, which in turn will start Nginx and uWSGI CMD ["/start.sh"] diff --git a/python3.7/start.sh b/python3.7/start.sh deleted file mode 100644 index 81580305..00000000 --- a/python3.7/start.sh +++ /dev/null @@ -1,15 +0,0 @@ -#! /usr/bin/env bash -set -e - -# If there's a prestart.sh script in the /app directory, run it before starting -PRE_START_PATH=/app/prestart.sh -echo "Checking for script in $PRE_START_PATH" -if [ -f $PRE_START_PATH ] ; then - echo "Running script $PRE_START_PATH" - source $PRE_START_PATH -else - echo "There is no script $PRE_START_PATH" -fi - -# Start Supervisor, with Nginx and uWSGI -exec /usr/bin/supervisord From 0185d05a42897a1c5dee5d0215add2e7e5dd43b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Ram=C3=ADrez?= Date: Fri, 10 May 2019 17:46:24 +0400 Subject: [PATCH 2/3] :memo: Add comment about start.sh in parent to python2.7 --- python2.7/Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/python2.7/Dockerfile b/python2.7/Dockerfile index 15a42656..1f3f53d2 100644 --- a/python2.7/Dockerfile +++ b/python2.7/Dockerfile @@ -29,6 +29,7 @@ RUN chmod +x /entrypoint.sh ENTRYPOINT ["/entrypoint.sh"] -# Run the start script, it will check for an /app/prestart.sh script (e.g. for migrations) +# Run the start script provided by the parent image tiangolo/uwsgi-nginx. +# It will check for an /app/prestart.sh script (e.g. for migrations) # And then will start Supervisor, which in turn will start Nginx and uWSGI CMD ["/start.sh"] From 87a351f4be1faec611ee703d010bf72ec2e31ccd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Ram=C3=ADrez?= Date: Fri, 10 May 2019 17:48:00 +0400 Subject: [PATCH 3/3] :memo: Update what's new --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 4ff09f91..a146f91c 100644 --- a/README.md +++ b/README.md @@ -853,6 +853,10 @@ You will see your Flask debugging server start, you will see how it sends respon ## What's new +2019-05-10: + +* Move `/start.sh` and `/app/prestart.sh` functionality to parent image. [PR #134](https://github.com/tiangolo/uwsgi-nginx-flask-docker/pull/134). + 2019-02-02: * The Nginx configurations are generated dynamically from the entrypoint, instead of modifying pre-existing files. [PR #50 in the parent image `uwsgi-nginx`](https://github.com/tiangolo/uwsgi-nginx-docker/pull/50) and [PR #121](https://github.com/tiangolo/uwsgi-nginx-flask-docker/pull/121).