From e91e26f7614c80dfbe5a393a8ad6bac1fbe0cfe4 Mon Sep 17 00:00:00 2001 From: Harpo Date: Thu, 23 Jun 2022 15:06:58 -0700 Subject: [PATCH 1/3] Copy files into production image --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index 2b120ea..84939b9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -39,3 +39,4 @@ RUN pip install "gunicorn>=20.1.0,<20.2.0" # phase facilities of your hosting platform. This is used only so the # Wagtail instance can be started with a simple "docker run" command. # CMD set -xe; python manage.py migrate --noinput; gunicorn ov_wag.wsgi:application --reload +COPY . . From 85782b88384138148c72cb40cbcb36f7216fbb6d Mon Sep 17 00:00:00 2001 From: Harpo Date: Thu, 23 Jun 2022 15:07:30 -0700 Subject: [PATCH 2/3] Unify working_dir across images --- Dockerfile | 2 ++ docker-compose.yml | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 84939b9..21e56ff 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,6 +14,8 @@ RUN apt-get update --yes --quiet && apt-get install --yes --quiet --no-install-r COPY requirements.txt / RUN pip install -r /requirements.txt +WORKDIR /app + # Build the production image, with the application server FROM base as production diff --git a/docker-compose.yml b/docker-compose.yml index ca694d1..29ef777 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,7 +8,6 @@ services: image: ov volumes: - ./:/app/ - working_dir: /app entrypoint: /app/docker_entrypoints/dev.sh deploy: restart_policy: @@ -23,7 +22,6 @@ services: image: ov-tests volumes: - ./:/app/ - working_dir: /app entrypoint: /app/docker_entrypoints/test.sh environment: - OV_DB_ENGINE=django.db.backends.sqlite3 From efe5942a998994bb01d812325f25f9dea551000a Mon Sep 17 00:00:00 2001 From: Harpo Date: Thu, 23 Jun 2022 15:07:53 -0700 Subject: [PATCH 3/3] Migrate from CMD to deploy ENTRYPOINT --- Dockerfile | 12 ++---------- docker_entrypoints/deploy.sh | 3 +++ 2 files changed, 5 insertions(+), 10 deletions(-) create mode 100755 docker_entrypoints/deploy.sh diff --git a/Dockerfile b/Dockerfile index 21e56ff..0a19343 100644 --- a/Dockerfile +++ b/Dockerfile @@ -31,14 +31,6 @@ EXPOSE 80 # Install the application server. RUN pip install "gunicorn>=20.1.0,<20.2.0" -# Runtime command that executes when "docker run" is called, it does the -# following: -# 1. Migrate the database. -# 2. Start the application server. -# WARNING: -# Migrating database at the same time as starting the server IS NOT THE BEST -# PRACTICE. The database should be migrated manually or using the release -# phase facilities of your hosting platform. This is used only so the -# Wagtail instance can be started with a simple "docker run" command. -# CMD set -xe; python manage.py migrate --noinput; gunicorn ov_wag.wsgi:application --reload COPY . . + +ENTRYPOINT /app/docker_entrypoints/deploy.sh diff --git a/docker_entrypoints/deploy.sh b/docker_entrypoints/deploy.sh new file mode 100755 index 0000000..dbc9731 --- /dev/null +++ b/docker_entrypoints/deploy.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +gunicorn ov_wag.wsgi:application --reload