From 31bb7734ce66f24afd8599ea596b7c58f02fcd2b Mon Sep 17 00:00:00 2001 From: Oliver Date: Thu, 12 Aug 2021 22:01:14 +1000 Subject: [PATCH] Update dockerfile to allow downloading against a specific git tag --- docker/Dockerfile | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index b6005ea49c..c69fa82a71 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -4,6 +4,9 @@ FROM alpine:3.13 as base ARG repository="https://github.com/inventree/InvenTree.git" ARG branch="master" +# Optionally specify a particular tag to checkout +ARG tag="" + ENV PYTHONUNBUFFERED 1 # InvenTree key settings @@ -12,8 +15,9 @@ ENV PYTHONUNBUFFERED 1 ENV INVENTREE_HOME="/home/inventree" # GitHub settings -ENV INVENTREE_REPO="${repository}" -ENV INVENTREE_BRANCH="${branch}" +ENV INVENTREE_GIT_REPO="${repository}" +ENV INVENTREE_GIT_BRANCH="${branch}" +ENV INVENTREE_GIT_TAG="${tag}" ENV INVENTREE_LOG_LEVEL="INFO" ENV INVENTREE_DOCKER="true" @@ -80,8 +84,12 @@ RUN pip install --no-cache-dir -U gunicorn FROM base as production # Clone source code -RUN echo "Downloading InvenTree from ${INVENTREE_REPO}" -RUN git clone --branch ${INVENTREE_BRANCH} --depth 1 ${INVENTREE_REPO} ${INVENTREE_HOME} +RUN echo "Downloading InvenTree from ${INVENTREE_GIT_REPO}" + +RUN git clone --branch ${INVENTREE_GIT_BRANCH} --depth 1 ${INVENTREE_GIT_REPO} ${INVENTREE_HOME} + +# Checkout against a particular git tag +RUN if [ -n "${INVENTREE_GIT_TAG}" ] ; then cd ${INVENTREE_HOME} && git fetch --all --tags && git checkout tags/${INVENTREE_GIT_TAG} -b v${INVENTREE_GIT_TAG}-branch ; fi # Install InvenTree packages RUN pip install --no-cache-dir -U -r ${INVENTREE_HOME}/requirements.txt