aboutsummaryrefslogtreecommitdiffstats
path: root/docker
diff options
context:
space:
mode:
authorGravatar Johannes Christ <[email protected]>2019-04-07 19:39:52 +0200
committerGravatar GitHub <[email protected]>2019-04-07 19:39:52 +0200
commit7e9133d1ac2b4cb82a9ee0dead37f342933ce8d4 (patch)
tree787f45a1ba5e1f16b9cd7d9e8cdf660573914151 /docker
parentSet `harakiri = 30`. (diff)
parentAddress review by @jchristgit (diff)
Merge pull request #198 from gdude2002/django+176/project-layout
[Fixes #158, #160, #176, #193] Project layout changes
Diffstat (limited to 'docker')
-rw-r--r--docker/app/Dockerfile (renamed from docker/app/stretch/3.6/Dockerfile)15
-rw-r--r--docker/app/alpine/3.6/Dockerfile29
-rw-r--r--docker/app/alpine/3.7/Dockerfile28
-rwxr-xr-xdocker/app/migrate_and_serve.sh6
-rw-r--r--docker/app/stretch/3.7/Dockerfile33
-rw-r--r--docker/app/uwsgi.ini6
6 files changed, 19 insertions, 98 deletions
diff --git a/docker/app/stretch/3.6/Dockerfile b/docker/app/Dockerfile
index 8a37925c..93d0c378 100644
--- a/docker/app/stretch/3.6/Dockerfile
+++ b/docker/app/Dockerfile
@@ -1,4 +1,4 @@
-FROM python:3.6-stretch
+FROM bitnami/python:3.7-prod
STOPSIGNAL SIGQUIT
ARG EXTRAS=deploy
@@ -21,10 +21,19 @@ RUN apt-get update -y \
rm -rf /var/lib/apt/lists/*
WORKDIR /app
-COPY setup.py /app/setup.py
-RUN python3 -m pip install .[$EXTRAS]
+
+COPY Pipfile Pipfile.lock /app/
+
+RUN rm -r /opt/bitnami/python/lib/python3.*/site-packages/setuptools* && \
+ pip install --no-cache-dir -U setuptools
+
+RUN python3 -m pip install pipenv \
+ && python3 -m pipenv install --dev --system --deploy
+
COPY . .
+RUN SECRET_KEY=placeholder DATABASE_URL=sqlite:// python3 manage.py collectstatic --no-input --clear --verbosity 0
+
RUN apt-get purge -y \
gcc \
libc-dev \
diff --git a/docker/app/alpine/3.6/Dockerfile b/docker/app/alpine/3.6/Dockerfile
deleted file mode 100644
index 7578418c..00000000
--- a/docker/app/alpine/3.6/Dockerfile
+++ /dev/null
@@ -1,29 +0,0 @@
-FROM python:3.6-alpine
-
-STOPSIGNAL SIGQUIT
-ARG EXTRAS=deploy
-
-RUN adduser \
- -D \
- -H \
- -u 1500 \
- pysite
-
-RUN apk add --no-cache --virtual build \
- gcc \
- linux-headers \
- musl-dev \
- && \
- apk add --no-cache \
- curl \
- postgresql-dev
-
-WORKDIR /app
-COPY pyproject.toml /app/pyproject.toml
-RUN python3 -m pip install poetry \
- && python3 -m poetry install --extras deploy \
- && apk del --purge build
-
-COPY . .
-
-CMD ["uwsgi", "--ini", "docker/app/uwsgi.ini"]
diff --git a/docker/app/alpine/3.7/Dockerfile b/docker/app/alpine/3.7/Dockerfile
deleted file mode 100644
index 7e639c29..00000000
--- a/docker/app/alpine/3.7/Dockerfile
+++ /dev/null
@@ -1,28 +0,0 @@
-FROM python:3.7-alpine
-
-STOPSIGNAL SIGQUIT
-
-RUN adduser \
- -D \
- -H \
- -u 1500 \
- pysite
-
-RUN apk add --no-cache --update --virtual build \
- gcc \
- linux-headers \
- musl-dev \
- && \
- apk add \
- curl \
- postgresql-dev
-
-WORKDIR /app
-COPY pyproject.toml /app/pyproject.toml
-RUN python3 -m pip install poetry \
- && python3 -m poetry install --extras deploy \
- && apk del --purge build
-
-COPY . .
-
-CMD ["uwsgi", "--ini", "docker/app/uwsgi.ini"]
diff --git a/docker/app/migrate_and_serve.sh b/docker/app/migrate_and_serve.sh
index 032504e2..2fe7841f 100755
--- a/docker/app/migrate_and_serve.sh
+++ b/docker/app/migrate_and_serve.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/sh -eu
### NOTE
# This file is intended to be used by local setups.
@@ -8,6 +8,8 @@
# a convenience to run migrations and start a development server.
echo [i] Applying migrations.
-python manage.py migrate --verbosity 0
+python manage.py migrate --verbosity 1
+echo [i] Collecting static files.
+python manage.py collectstatic --no-input --clear --verbosity 0
echo [i] Starting server.
python manage.py runserver 0.0.0.0:8000
diff --git a/docker/app/stretch/3.7/Dockerfile b/docker/app/stretch/3.7/Dockerfile
deleted file mode 100644
index 1674eece..00000000
--- a/docker/app/stretch/3.7/Dockerfile
+++ /dev/null
@@ -1,33 +0,0 @@
-FROM python:3.7-stretch
-
-STOPSIGNAL SIGQUIT
-ARG EXTRAS=deploy
-
-RUN adduser \
- --disabled-login \
- --no-create-home \
- --uid 1500 \
- pysite
-
-RUN apt-get update -y \
- && \
- apt-get install --no-install-recommends -y \
- gcc \
- libc-dev \
- libpq-dev \
- && \
- apt-get clean \
- && \
- rm -rf /var/lib/apt/lists/*
-
-WORKDIR /app
-COPY setup.py /app/setup.py
-RUN python3 -m pip install .[$EXTRAS]
-COPY . .
-
-RUN apt-get purge -y \
- gcc \
- libc-dev \
- libpq-dev
-
-CMD ["uwsgi", "--ini", "docker/app/uwsgi.ini"]
diff --git a/docker/app/uwsgi.ini b/docker/app/uwsgi.ini
index 73014167..3f35258c 100644
--- a/docker/app/uwsgi.ini
+++ b/docker/app/uwsgi.ini
@@ -5,7 +5,7 @@ socket = :4000
### File settings
# WSGI application
-wsgi = pysite.wsgi:application
+wsgi = pydis_site.wsgi:application
# Directory to move into at startup
chdir = /app
@@ -18,8 +18,8 @@ cheaper = 1
workers = 4
# Automatically set up meanginful process names
auto-procname = true
-# Prefix process names with `pysite : `
-procname-prefix-spaced = pysite :
+# Prefix process names with `pydis_site : `
+procname-prefix-spaced = pydis_site :
### Worker options
# Kill workers if they take more than 30 seconds to respond.