diff options
Diffstat (limited to 'docker/app')
-rw-r--r-- | docker/app/Dockerfile | 20 | ||||
-rw-r--r-- | docker/app/build-wiki.Dockerfile | 2 | ||||
-rw-r--r-- | docker/app/local.Dockerfile | 21 | ||||
-rw-r--r-- | docker/app/scripts/build-wiki.sh | 4 | ||||
-rw-r--r-- | docker/app/wheels/wiki-0.5.dev20190420204942-py3-none-any.whl | bin | 0 -> 1287002 bytes |
5 files changed, 26 insertions, 21 deletions
diff --git a/docker/app/Dockerfile b/docker/app/Dockerfile index 67b3ef69..a6986fb2 100644 --- a/docker/app/Dockerfile +++ b/docker/app/Dockerfile @@ -1,29 +1,27 @@ -FROM bitnami/python:3.7-prod +FROM python:3.7-slim -# I have no idea what this does. +# 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 a user. +# Create non-root user. RUN useradd --system --shell /bin/false --uid 1500 pysite -# Install prerequisites needed to complete the dependency installation. -RUN install_packages git gcc libc-dev libpq-dev +# Install pipenv & pyuwsgi +RUN pip install -U pipenv pyuwsgi -# Copy the project files into the working directory. +# Copy the project files into working directory WORKDIR /app COPY . . -# Update setuptools by removing egg first, add other dependencies -RUN rm -r /opt/bitnami/python/lib/python3.*/site-packages/setuptools* && \ - pip install -U setuptools -RUN pip install pipenv uwsgi +# Install project dependencies RUN pipenv install --system --deploy -# Migrate, collect and start the app. +# 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"] diff --git a/docker/app/build-wiki.Dockerfile b/docker/app/build-wiki.Dockerfile new file mode 100644 index 00000000..92003377 --- /dev/null +++ b/docker/app/build-wiki.Dockerfile @@ -0,0 +1,2 @@ +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 index 2c95cea3..9e15c438 100644 --- a/docker/app/local.Dockerfile +++ b/docker/app/local.Dockerfile @@ -1,27 +1,28 @@ -FROM bitnami/python:3.7-prod +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 a user. +# Create non-root user RUN useradd --system --shell /bin/false --uid 1500 pysite -# Install prerequisites needed to complete the dependency installation. -RUN install_packages git gcc libc-dev libpq-dev +# Install pipenv & pyuwsgi +RUN pip install -U pipenv pyuwsgi -# Copy the project files into the working directory. +# Copy the project files into working directory WORKDIR /app COPY . . -# Update setuptools by removing egg first, add other dependencies -RUN rm -r /opt/bitnami/python/lib/python3.*/site-packages/setuptools* && \ - pip install -U setuptools -RUN pip install pipenv uwsgi +# Install project dependencies RUN pipenv install --system --deploy -RUN SECRET_KEY=placeholder DATABASE_URL=sqlite:// python3 manage.py collectstatic --no-input --clear --verbosity 0 +# 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 new file mode 100644 index 00000000..07c54f66 --- /dev/null +++ b/docker/app/scripts/build-wiki.sh @@ -0,0 +1,4 @@ +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/wheels/wiki-0.5.dev20190420204942-py3-none-any.whl b/docker/app/wheels/wiki-0.5.dev20190420204942-py3-none-any.whl Binary files differnew file mode 100644 index 00000000..b7637e76 --- /dev/null +++ b/docker/app/wheels/wiki-0.5.dev20190420204942-py3-none-any.whl |