aboutsummaryrefslogtreecommitdiffstats
path: root/docker
diff options
context:
space:
mode:
authorGravatar scragly <[email protected]>2019-09-28 06:20:07 +1000
committerGravatar scragly <[email protected]>2019-09-28 06:20:07 +1000
commit4769c8b5e3ba70301b1123c5750429b2092b01b1 (patch)
tree172f46a1b495a3b6948e183165a3e623b1462380 /docker
parentEnsure docker containers are published only for master branch bu… (#264) (diff)
Create custom manage.py entry point, remove scripts and merge Dockerfile.
Diffstat (limited to 'docker')
-rw-r--r--docker/Dockerfile (renamed from docker/app/Dockerfile)11
-rw-r--r--docker/app/build-wiki.Dockerfile2
-rw-r--r--docker/app/local.Dockerfile28
-rw-r--r--docker/app/scripts/build-wiki.sh4
-rwxr-xr-xdocker/app/scripts/migrate.sh10
-rwxr-xr-xdocker/app/scripts/migrate_and_serve.sh21
-rw-r--r--docker/uwsgi.ini (renamed from docker/app/uwsgi.ini)0
-rw-r--r--docker/wheels/wiki-0.5.dev20190420204942-py3-none-any.whl (renamed from docker/app/wheels/wiki-0.5.dev20190420204942-py3-none-any.whl)bin1287002 -> 1287002 bytes
8 files changed, 5 insertions, 71 deletions
diff --git a/docker/app/Dockerfile b/docker/Dockerfile
index a6986fb2..aa427947 100644
--- a/docker/app/Dockerfile
+++ b/docker/Dockerfile
@@ -11,8 +11,8 @@ ENV PIP_NO_CACHE_DIR=false \
# Create non-root user.
RUN useradd --system --shell /bin/false --uid 1500 pysite
-# Install pipenv & pyuwsgi
-RUN pip install -U pipenv pyuwsgi
+# Install pipenv
+RUN pip install -U pipenv
# Copy the project files into working directory
WORKDIR /app
@@ -21,7 +21,6 @@ COPY . .
# Install project dependencies
RUN pipenv install --system --deploy
-# Migrate, collect and start the app
-RUN chmod +x /app/docker/app/scripts/migrate.sh
-ENTRYPOINT ["/app/docker/app/scripts/migrate.sh"]
-CMD ["uwsgi", "--ini", "docker/app/uwsgi.ini"]
+# Run web server through custom manager
+ENTRYPOINT ["python", "manage.py"]
+CMD ["run"]
diff --git a/docker/app/build-wiki.Dockerfile b/docker/app/build-wiki.Dockerfile
deleted file mode 100644
index 92003377..00000000
--- a/docker/app/build-wiki.Dockerfile
+++ /dev/null
@@ -1,2 +0,0 @@
-FROM python:3.7
-RUN pip --no-cache-dir wheel --wheel-dir=/wheels "wiki @ git+https://github.com/python-discord/django-wiki.git"
diff --git a/docker/app/local.Dockerfile b/docker/app/local.Dockerfile
deleted file mode 100644
index 9e15c438..00000000
--- a/docker/app/local.Dockerfile
+++ /dev/null
@@ -1,28 +0,0 @@
-FROM python:3.7-slim
-
-# Allow service to handle stops gracefully
-STOPSIGNAL SIGQUIT
-
-# Set pip to have cleaner logs and no saved cache
-ENV PIP_NO_CACHE_DIR=false \
- PIPENV_HIDE_EMOJIS=1 \
- PIPENV_NOSPIN=1
-
-# Create non-root user
-RUN useradd --system --shell /bin/false --uid 1500 pysite
-
-# Install pipenv & pyuwsgi
-RUN pip install -U pipenv pyuwsgi
-
-# Copy the project files into working directory
-WORKDIR /app
-COPY . .
-
-# Install project dependencies
-RUN pipenv install --system --deploy
-
-# Prepare static files for site
-RUN SECRET_KEY=placeholder DATABASE_URL=sqlite:// \
- python3 manage.py collectstatic --no-input --clear --verbosity 0
-
-CMD ["uwsgi", "--ini", "docker/app/uwsgi.ini"]
diff --git a/docker/app/scripts/build-wiki.sh b/docker/app/scripts/build-wiki.sh
deleted file mode 100644
index 07c54f66..00000000
--- a/docker/app/scripts/build-wiki.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-docker build -t build_uwsgi -f docker/app/build-wiki.Dockerfile .
-CONTAINER=$(docker run -itd build_uwsgi /bin/bash)
-docker cp "$CONTAINER:/wheels" docker/app
-docker stop "$CONTAINER"
diff --git a/docker/app/scripts/migrate.sh b/docker/app/scripts/migrate.sh
deleted file mode 100755
index 22636c93..00000000
--- a/docker/app/scripts/migrate.sh
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/usr/bin/env bash
-
-echo --- Applying migrations ---
-python manage.py migrate --verbosity 1
-
-echo --- Collecting static files ---
-python manage.py collectstatic --no-input --clear --verbosity 1
-
-echo --- Starting uwsgi ---
-exec "$@" # This runs the CMD at the end of the Dockerfile
diff --git a/docker/app/scripts/migrate_and_serve.sh b/docker/app/scripts/migrate_and_serve.sh
deleted file mode 100755
index c30d7e04..00000000
--- a/docker/app/scripts/migrate_and_serve.sh
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/bin/sh
-set -eu
-
-### NOTE
-# This file is intended to be used by local setups.
-# You do not want to run the Django development server
-# in production. The default Dockerfile command will
-# run using uWSGI, this script is provided purely as
-# a convenience to run migrations and start a development server.
-
-echo [i] Applying migrations.
-python manage.py migrate --verbosity 1
-
-echo [i] Collecting static files.
-python manage.py collectstatic --no-input --clear --verbosity 1
-
-echo [i] Creating a superuser.
-echo "from django.contrib.auth import get_user_model; User = get_user_model(); User.objects.create_superuser('admin', 'admin', 'admin') if not User.objects.filter(username='admin').exists() else print('Admin user already exists')" | python manage.py shell
-
-echo [i] Starting server.
-python manage.py runserver 0.0.0.0:8000
diff --git a/docker/app/uwsgi.ini b/docker/uwsgi.ini
index 3f35258c..3f35258c 100644
--- a/docker/app/uwsgi.ini
+++ b/docker/uwsgi.ini
diff --git a/docker/app/wheels/wiki-0.5.dev20190420204942-py3-none-any.whl b/docker/wheels/wiki-0.5.dev20190420204942-py3-none-any.whl
index b7637e76..b7637e76 100644
--- a/docker/app/wheels/wiki-0.5.dev20190420204942-py3-none-any.whl
+++ b/docker/wheels/wiki-0.5.dev20190420204942-py3-none-any.whl
Binary files differ