diff options
author | Cody Hiar <cody@hiar.ca> | 2021-02-03 14:29:24 -0700 |
---|---|---|
committer | Cody Hiar <cody@hiar.ca> | 2021-02-03 14:29:24 -0700 |
commit | 2b007a5a500b635ddcfe4b9a512777f3d21fa6b6 (patch) | |
tree | 7a9ccb2d41222fc571c6d08b169d4946e26c130c /docker/Dockerfile |
Initial commit of project
Diffstat (limited to 'docker/Dockerfile')
-rw-r--r-- | docker/Dockerfile | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..dedd538 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,47 @@ +#################### +# Dependancy Builder +#################### +FROM python:3.7-stretch AS builder + +# Set working directory +WORKDIR /usr/src/app + +# Turns off writing .pyc files; superfluous on an ephemeral container. +ENV PYTHONDONTWRITEBYTECODE=1 +# Seems to speed things up +ENV PYTHONUNBUFFERED=1 + +# Use the executables from the virtualenv instead of globals +ENV PATH="/opt/venv/bin:$PATH" + +# Setup virtualenv to build dependancies into +RUN python -m venv /opt/venv + +# Install python dependancies +COPY requirements.txt ./requirements.txt +RUN pip install --no-cache-dir -r requirements.txt + +##################### +# Condensed App Image +##################### + +# Smaller official Debian-based Python image +FROM python:3.7-slim-stretch AS app + +# Set working directory +WORKDIR /usr/src/app + +# Extra python env +ENV PYTHONDONTWRITEBYTECODE=1 +ENV PYTHONUNBUFFERED=1 +ENV PIP_DISABLE_PIP_VERSION_CHECK=1 +ENV PATH="/opt/venv/bin:$PATH" + +# Setup the virtualenv +RUN python -m venv /opt/venv + +# Copy in tools and python environment +COPY --from=builder /opt/venv /opt/venv + +# Copy in the rest of the app +COPY ./ /usr/src/app |