Checkout the repository with git

This changes the build process even further. Instead
f using `wget` to fetch the current code, `git` is used.
This allows for faster switching between branches,
because only the differences between them have to be
fetched from the server.

But the main advantage is that the build cache can
finally be used as designed by Docker. Repetitive
builds are very fast now. This is also true between
branches and tags, as long as the `requirements.txt`
file doesn't change.
This commit is contained in:
Christian Mäder 2019-10-14 21:54:49 +02:00
parent f3b9c34e3b
commit 20109c3392
5 changed files with 149 additions and 166 deletions

View file

@ -28,7 +28,8 @@ RUN pip install --install-option="--prefix=/install" \
# django_auth_ldap is required for ldap
django_auth_ldap
COPY .netbox/netbox/requirements.txt /
ARG NETBOX_PATH
COPY ${NETBOX_PATH}/requirements.txt /
RUN pip install --install-option="--prefix=/install" -r /requirements.txt
###
@ -53,7 +54,9 @@ RUN apk add --no-cache \
WORKDIR /opt
COPY --from=builder /install /usr/local
COPY .netbox/netbox /opt/netbox
ARG NETBOX_PATH
COPY ${NETBOX_PATH} /opt/netbox
COPY docker/configuration.docker.py /opt/netbox/netbox/netbox/configuration.py
COPY configuration/gunicorn_config.py /etc/netbox/config/
@ -69,13 +72,11 @@ ENTRYPOINT [ "/opt/netbox/docker-entrypoint.sh" ]
CMD ["gunicorn", "-c /etc/netbox/config/gunicorn_config.py", "netbox.wsgi"]
LABEL SRC_URL="$URL"
ARG NETBOX_DOCKER_PROJECT_VERSION=snapshot
LABEL NETBOX_DOCKER_PROJECT_VERSION="$NETBOX_DOCKER_PROJECT_VERSION"
ARG NETBOX_BRANCH=custom_build
LABEL NETBOX_BRANCH="$NETBOX_BRANCH"
LABEL NETBOX_DOCKER_PROJECT_VERSION="custom build" \
NETBOX_BRANCH="custom build" \
ORIGINAL_DOCKER_TAG="custom build" \
NETBOX_GIT_COMMIT="not built from git" \
NETBOX_GIT_URL="not built from git"
#####
## LDAP specific configuration