aboutsummaryrefslogtreecommitdiffstats
path: root/docker
diff options
context:
space:
mode:
Diffstat (limited to 'docker')
-rw-r--r--docker/app/alpine/3.6/Dockerfile28
-rw-r--r--docker/app/alpine/3.7/Dockerfile28
-rw-r--r--docker/app/stretch/3.6/Dockerfile33
-rw-r--r--docker/app/stretch/3.7/Dockerfile33
-rw-r--r--docker/app/uwsgi.ini32
-rw-r--r--docker/nging/Dockerfile18
6 files changed, 154 insertions, 18 deletions
diff --git a/docker/app/alpine/3.6/Dockerfile b/docker/app/alpine/3.6/Dockerfile
new file mode 100644
index 00000000..b9cb557b
--- /dev/null
+++ b/docker/app/alpine/3.6/Dockerfile
@@ -0,0 +1,28 @@
+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 setup.py /app/setup.py
+RUN python3 -m pip install .[$EXTRAS]
+RUN 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
new file mode 100644
index 00000000..4a8b5b34
--- /dev/null
+++ b/docker/app/alpine/3.7/Dockerfile
@@ -0,0 +1,28 @@
+FROM python:3.7-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 setup.py /app/setup.py
+RUN python3 -m pip install .[$EXTRAS]
+RUN apk del --purge build
+
+COPY . .
+
+CMD ["uwsgi", "--ini", "docker/app/uwsgi.ini"]
diff --git a/docker/app/stretch/3.6/Dockerfile b/docker/app/stretch/3.6/Dockerfile
new file mode 100644
index 00000000..8a37925c
--- /dev/null
+++ b/docker/app/stretch/3.6/Dockerfile
@@ -0,0 +1,33 @@
+FROM python:3.6-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/stretch/3.7/Dockerfile b/docker/app/stretch/3.7/Dockerfile
new file mode 100644
index 00000000..1674eece
--- /dev/null
+++ b/docker/app/stretch/3.7/Dockerfile
@@ -0,0 +1,33 @@
+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
new file mode 100644
index 00000000..3bfcd3f8
--- /dev/null
+++ b/docker/app/uwsgi.ini
@@ -0,0 +1,32 @@
+[uwsgi]
+### Exposed ports
+# uWSGI protocol socket
+socket = :4000
+
+### File settings
+# WSGI application
+wsgi = pysite.wsgi:application
+# Directory to move into at startup
+chdir = /app
+
+### Concurrency options
+# Run a master to supervise the workers
+master = true
+# Keep a minimum of 1 worker
+cheaper = 1
+# Allow a maximum of 4 workers
+workers = 4
+# Automatically set up meanginful process names
+auto-procname = true
+# Prefix process names with `pysite : `
+procname-prefix-spaced = pysite :
+
+### Startup settings
+# Exit if we can't load the app
+need-app = true
+# `setuid` to an unprivileged user
+uid = 1500
+
+### Hook setup
+# Gracefully kill workers on `SIGQUIT`
+hook-master-start = unix_signal:3 gracefully_kill_them_all
diff --git a/docker/nging/Dockerfile b/docker/nging/Dockerfile
deleted file mode 100644
index 378099b8..00000000
--- a/docker/nging/Dockerfile
+++ /dev/null
@@ -1,18 +0,0 @@
-FROM pythondiscord/django AS builder
-
-ENV DATABASE_URL postgres://user:pass@host/db
-ENV SECRET_KEY unused
-
-RUN mkdir -p /var/www/pythondiscord.com
-
-RUN python3 manage.py collectstatic --noinput
-
-
-## NGINX setup
-# Copy over only the static files from the previous stage
-# to ensure a minimal image size in our NGINX container.
-FROM nginx:alpine
-
-COPY --from=builder /var/www/pythondiscord.com /var/www/pythondiscord.com
-
-CMD ["nginx", "-g", "daemon off;"]