From 2b007a5a500b635ddcfe4b9a512777f3d21fa6b6 Mon Sep 17 00:00:00 2001 From: Cody Hiar Date: Wed, 3 Feb 2021 14:29:24 -0700 Subject: Initial commit of project --- docker/Dockerfile | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 docker/Dockerfile (limited to 'docker/Dockerfile') 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 -- cgit v1.2.3