diff options
author | 2019-09-21 22:14:46 +1000 | |
---|---|---|
committer | 2019-09-21 22:14:46 +1000 | |
commit | e8854540c6d70618d2148d8c1a9d2384502096b1 (patch) | |
tree | 917d559be3e5179f234e3f67fd352393e4ac0de1 /docker | |
parent | Use a .whl for `wiki` package instead of git repo. (diff) |
Change back to official python base image, remove git pkg
Diffstat (limited to 'docker')
-rw-r--r-- | docker/app/Dockerfile | 21 | ||||
-rw-r--r-- | docker/app/local.Dockerfile | 22 |
2 files changed, 18 insertions, 25 deletions
diff --git a/docker/app/Dockerfile b/docker/app/Dockerfile index 67b3ef69..7059dd9b 100644 --- a/docker/app/Dockerfile +++ b/docker/app/Dockerfile @@ -1,29 +1,24 @@ -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 - -# 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 -RUN pipenv install --system --deploy +# Install project dependencies +RUN pip install -U pipenv pyuwsgi && 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/local.Dockerfile b/docker/app/local.Dockerfile index 2c95cea3..e53e300f 100644 --- a/docker/app/local.Dockerfile +++ b/docker/app/local.Dockerfile @@ -1,27 +1,25 @@ -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 - -# 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 -RUN pipenv install --system --deploy +# Install project dependencies +RUN pip install -U pipenv pyuwsgi && 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"] |