Merge pull request #202 from netbox-community/prepare_184
Prepares scripts and documentation for #184
This commit is contained in:
commit
7af88388bb
|
@ -11,21 +11,21 @@ Autotest: Internal and External Pull Requests
|
||||||
Repository Links: Enable for Base Image
|
Repository Links: Enable for Base Image
|
||||||
Build Rules:
|
Build Rules:
|
||||||
- Source Type: Branch
|
- Source Type: Branch
|
||||||
Source: master
|
Source: release
|
||||||
Docker Tag: branches
|
Docker Tag: branches
|
||||||
Dockerfile location: Dockerfile
|
Dockerfile location: Dockerfile
|
||||||
Build Context: /
|
Build Context: /
|
||||||
Autobuild: on
|
Autobuild: on
|
||||||
Build Caching: on
|
Build Caching: on
|
||||||
- Source Type: Branch
|
- Source Type: Branch
|
||||||
Source: master
|
Source: release
|
||||||
Docker Tag: prerelease
|
Docker Tag: prerelease
|
||||||
Dockerfile location: Dockerfile
|
Dockerfile location: Dockerfile
|
||||||
Build Context: /
|
Build Context: /
|
||||||
Autobuild: on
|
Autobuild: on
|
||||||
Build Caching: on
|
Build Caching: on
|
||||||
- Source Type: Branch
|
- Source Type: Branch
|
||||||
Source: master
|
Source: release
|
||||||
Docker Tag: release
|
Docker Tag: release
|
||||||
Dockerfile location: Dockerfile
|
Dockerfile location: Dockerfile
|
||||||
Build Context: /
|
Build Context: /
|
||||||
|
|
|
@ -43,10 +43,10 @@ Then there is currently one extra tags for each of the above labels:
|
||||||
|
|
||||||
## Quickstart
|
## Quickstart
|
||||||
|
|
||||||
To get Netbox up and running:
|
To get Netbox up and running in Docker:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git clone -b master https://github.com/netbox-community/netbox-docker.git
|
git clone -b release https://github.com/netbox-community/netbox-docker.git
|
||||||
cd netbox-docker
|
cd netbox-docker
|
||||||
docker-compose pull
|
docker-compose pull
|
||||||
docker-compose up -d
|
docker-compose up -d
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Builds develop, develop-* and master branches
|
# Builds develop, develop-* and master branches of Netbox
|
||||||
|
|
||||||
echo "▶️ $0 $*"
|
echo "▶️ $0 $*"
|
||||||
|
|
||||||
|
|
20
build.sh
20
build.sh
|
@ -27,9 +27,9 @@ if [ "${1}x" == "x" ] || [ "${1}" == "--help" ] || [ "${1}" == "-h" ]; then
|
||||||
echo " Default: undefined"
|
echo " Default: undefined"
|
||||||
echo " TAG The version part of the docker tag."
|
echo " TAG The version part of the docker tag."
|
||||||
echo " Default:"
|
echo " Default:"
|
||||||
echo " When \${BRANCH}=master: latest"
|
echo " When <branch>=master: latest"
|
||||||
echo " When \${BRANCH}=develop: snapshot"
|
echo " When <branch>=develop: snapshot"
|
||||||
echo " Else: same as \${BRANCH}"
|
echo " Else: same as <branch>"
|
||||||
echo " DOCKER_REGISTRY The Docker repository's registry (i.e. '\${DOCKER_REGISTRY}/\${DOCKER_ORG}/\${DOCKER_REPO}'')"
|
echo " DOCKER_REGISTRY The Docker repository's registry (i.e. '\${DOCKER_REGISTRY}/\${DOCKER_ORG}/\${DOCKER_REPO}'')"
|
||||||
echo " Used for tagging the image."
|
echo " Used for tagging the image."
|
||||||
echo " Default: docker.io"
|
echo " Default: docker.io"
|
||||||
|
@ -106,7 +106,7 @@ fi
|
||||||
###
|
###
|
||||||
SRC_ORG="${SRC_ORG-netbox-community}"
|
SRC_ORG="${SRC_ORG-netbox-community}"
|
||||||
SRC_REPO="${SRC_REPO-netbox}"
|
SRC_REPO="${SRC_REPO-netbox}"
|
||||||
BRANCH="${1}"
|
NETBOX_BRANCH="${1}"
|
||||||
URL="${URL-https://github.com/${SRC_ORG}/${SRC_REPO}.git}"
|
URL="${URL-https://github.com/${SRC_ORG}/${SRC_REPO}.git}"
|
||||||
NETBOX_PATH="${NETBOX_PATH-.netbox}"
|
NETBOX_PATH="${NETBOX_PATH-.netbox}"
|
||||||
|
|
||||||
|
@ -114,9 +114,9 @@ NETBOX_PATH="${NETBOX_PATH-.netbox}"
|
||||||
# fetching the source
|
# fetching the source
|
||||||
###
|
###
|
||||||
if [ "${2}" != "--push-only" ] && [ -z "${SKIP_GIT}" ] ; then
|
if [ "${2}" != "--push-only" ] && [ -z "${SKIP_GIT}" ] ; then
|
||||||
echo "🌐 Checking out '${BRANCH}' of netbox from the url '${URL}' into '${NETBOX_PATH}'"
|
echo "🌐 Checking out '${NETBOX_BRANCH}' of netbox from the url '${URL}' into '${NETBOX_PATH}'"
|
||||||
if [ ! -d "${NETBOX_PATH}" ]; then
|
if [ ! -d "${NETBOX_PATH}" ]; then
|
||||||
$DRY git clone -q --depth 10 -b "${BRANCH}" "${URL}" "${NETBOX_PATH}"
|
$DRY git clone -q --depth 10 -b "${NETBOX_BRANCH}" "${URL}" "${NETBOX_PATH}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
(
|
(
|
||||||
|
@ -127,7 +127,7 @@ if [ "${2}" != "--push-only" ] && [ -z "${SKIP_GIT}" ] ; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
$DRY git remote set-url origin "${URL}"
|
$DRY git remote set-url origin "${URL}"
|
||||||
$DRY git fetch -qp --depth 10 origin "${BRANCH}"
|
$DRY git fetch -qp --depth 10 origin "${NETBOX_BRANCH}"
|
||||||
$DRY git checkout -qf FETCH_HEAD
|
$DRY git checkout -qf FETCH_HEAD
|
||||||
$DRY git prune
|
$DRY git prune
|
||||||
)
|
)
|
||||||
|
@ -174,13 +174,13 @@ fi
|
||||||
DOCKER_REGISTRY="${DOCKER_REGISTRY-docker.io}"
|
DOCKER_REGISTRY="${DOCKER_REGISTRY-docker.io}"
|
||||||
DOCKER_ORG="${DOCKER_ORG-netboxcommunity}"
|
DOCKER_ORG="${DOCKER_ORG-netboxcommunity}"
|
||||||
DOCKER_REPO="${DOCKER_REPO-netbox}"
|
DOCKER_REPO="${DOCKER_REPO-netbox}"
|
||||||
case "${BRANCH}" in
|
case "${NETBOX_BRANCH}" in
|
||||||
master)
|
master)
|
||||||
TAG="${TAG-latest}";;
|
TAG="${TAG-latest}";;
|
||||||
develop)
|
develop)
|
||||||
TAG="${TAG-snapshot}";;
|
TAG="${TAG-snapshot}";;
|
||||||
*)
|
*)
|
||||||
TAG="${TAG-$BRANCH}";;
|
TAG="${TAG-$NETBOX_BRANCH}";;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
###
|
###
|
||||||
|
@ -241,7 +241,7 @@ for DOCKER_TARGET in "${DOCKER_TARGETS[@]}"; do
|
||||||
if [ "${DOCKER_TARGET}" == "main" ]; then
|
if [ "${DOCKER_TARGET}" == "main" ]; then
|
||||||
DOCKER_BUILD_ARGS+=(
|
DOCKER_BUILD_ARGS+=(
|
||||||
--label "ORIGINAL_TAG=${TARGET_DOCKER_TAG}"
|
--label "ORIGINAL_TAG=${TARGET_DOCKER_TAG}"
|
||||||
|
|
||||||
--label "org.label-schema.build-date=${BUILD_DATE}"
|
--label "org.label-schema.build-date=${BUILD_DATE}"
|
||||||
--label "org.opencontainers.image.created=${BUILD_DATE}"
|
--label "org.opencontainers.image.created=${BUILD_DATE}"
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ run_build() {
|
||||||
./build-branches.sh $@
|
./build-branches.sh $@
|
||||||
;;
|
;;
|
||||||
this) # Pull Requests
|
this) # Pull Requests
|
||||||
# only build the 'master' branch
|
# only build the 'master' branch of netbox
|
||||||
# (resulting in the 'latest' docker tag)
|
# (resulting in the 'latest' docker tag)
|
||||||
# and the 'main' target.
|
# and the 'main' target.
|
||||||
DOCKER_TARGET=main ./build.sh master
|
DOCKER_TARGET=main ./build.sh master
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
. hooks/common
|
. hooks/common
|
||||||
|
|
||||||
if [ "${SOURCE_BRANCH}" == "master" ] || [ "${DEBUG}" == "true" ]; then
|
if [ "${SOURCE_BRANCH}" == "release" ] || [ "${DEBUG}" == "true" ]; then
|
||||||
if [ "${SOURCE_BRANCH}" != "master" ]; then
|
if [ "${SOURCE_BRANCH}" != "release" ]; then
|
||||||
echo "⚠️⚠️⚠️ Would exit, but DEBUG is '${DEBUG}'".
|
echo "⚠️⚠️⚠️ Would exit, but DEBUG is '${DEBUG}'".
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue