Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
wallet-dapp
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hive
wallet-dapp
Merge requests
!1
Prepared definition of application docker image
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Prepared definition of application docker image
bw_caddy_based_app
into
main
Overview
0
Commits
5
Pipelines
2
Changes
4
Merged
Bartek Wrona
requested to merge
bw_caddy_based_app
into
main
1 week ago
Overview
0
Commits
5
Pipelines
2
Changes
4
Expand
Application image based on Caddy server (nginx didn't work correctly)
defined CI steps to build the image on CI
0
0
Merge request reports
Compare
main
version 1
fff616cd
1 week ago
main (base)
and
latest version
latest version
9617a253
5 commits,
1 week ago
version 1
fff616cd
4 commits,
1 week ago
4 files
+
206
−
19
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
4
Search (e.g. *.vue) (Ctrl+P)
scripts/ci-helpers/build_instance.sh
0 → 100755
+
125
−
0
Options
#! /bin/bash
set
-euo
pipefail
SCRIPTPATH
=
"
$(
cd
--
"
$(
dirname
"
$0
"
)
"
>
/dev/null 2>&1
;
pwd
-P
)
"
SCRIPTSDIR
=
"
$SCRIPTPATH
/.."
print_help
()
{
cat
<<-
EOF
Usage:
$0
<image_tag> <src_dir> <registry_url> [OPTION[=VALUE]]...
Builds docker image containing Hive Bridge application installation, ready to run. To spawn it, just run a container and map port 8080 to the host.
OPTIONS:
--help|-h|-? Display this help screen and exit
--progress=TYPE Determines how to display build progress (default: 'auto')
--push Allows to automatically push built image to the registry
EOF
}
PROGRESS_DISPLAY
=
${
PROGRESS_DISPLAY
:-
"auto"
}
IMAGE_OUTPUT
=
"--load"
BUILD_IMAGE_TAG
=
""
REGISTRY
=
""
SRCROOTDIR
=
""
while
[
$#
-gt
0
]
;
do
case
"
$1
"
in
--help
|
-h
|
-?
)
print_help
exit
0
;;
--progress
=
*
)
arg
=
"
${
1
#*=
}
"
PROGRESS_DISPLAY
=
"
$arg
"
;;
--push
)
IMAGE_OUTPUT
=
"--push"
;;
*
)
if
[
-z
"
$BUILD_IMAGE_TAG
"
]
;
then
BUILD_IMAGE_TAG
=
"
${
1
}
"
elif
[
-z
"
$SRCROOTDIR
"
]
;
then
SRCROOTDIR
=
"
${
1
}
"
elif
[
-z
"
$REGISTRY
"
]
;
then
REGISTRY
=
${
1
}
else
echo
"ERROR: '
$1
' is not a valid option/positional argument"
echo
print_help
exit
2
fi
;;
esac
shift
done
_TST_IMGTAG
=
${
BUILD_IMAGE_TAG
:?
"Missing arg #1 to specify built image tag"
}
_TST_SRCDIR
=
${
SRCROOTDIR
:?
"Missing arg #2 to specify source directory"
}
_TST_REGISTRY
=
${
REGISTRY
:?
"Missing arg #3 to specify target container registry"
}
# Supplement a registry path by trailing slash (if needed)
#[[ "${REGISTRY}" != */ ]] && REGISTRY="${REGISTRY}/"
echo
"Moving into source root directory:
${
SRCROOTDIR
}
"
pushd
"
$SRCROOTDIR
"
export
DOCKER_BUILDKIT
=
1
BUILD_TIME
=
"
$(
date
-uIseconds
)
"
GIT_COMMIT_SHA
=
"
$(
git rev-parse HEAD
||
true
)
"
if
[
-z
"
$GIT_COMMIT_SHA
"
]
;
then
GIT_COMMIT_SHA
=
"[unknown]"
fi
GIT_CURRENT_BRANCH
=
"
$(
git branch
--show-current
||
true
)
"
if
[
-z
"
$GIT_CURRENT_BRANCH
"
]
;
then
GIT_CURRENT_BRANCH
=
"
$(
git describe
--abbrev
=
0
--all
|
sed
's/^.*\///'
||
true
)
"
if
[
-z
"
$GIT_CURRENT_BRANCH
"
]
;
then
GIT_CURRENT_BRANCH
=
"[unknown]"
fi
fi
GIT_LAST_LOG_MESSAGE
=
"
$(
git log
-1
--pretty
=
%B
||
true
)
"
if
[
-z
"
$GIT_LAST_LOG_MESSAGE
"
]
;
then
GIT_LAST_LOG_MESSAGE
=
"[unknown]"
fi
GIT_LAST_COMMITTER
=
"
$(
git log
-1
--pretty
=
"%an <%ae>"
||
true
)
"
if
[
-z
"
$GIT_LAST_COMMITTER
"
]
;
then
GIT_LAST_COMMITTER
=
"[unknown]"
fi
GIT_LAST_COMMIT_DATE
=
"
$(
git log
-1
--pretty
=
"%aI"
||
true
)
"
if
[
-z
"
$GIT_LAST_COMMIT_DATE
"
]
;
then
GIT_LAST_COMMIT_DATE
=
"[unknown]"
fi
echo
-e
"
\n
Building base instance image...
\n
"
docker buildx build
--target
=
app
\
--progress
=
"
$PROGRESS_DISPLAY
"
\
--build-arg
BUILD_TIME
=
"
$BUILD_TIME
"
\
--build-arg
GIT_COMMIT_SHA
=
"
$GIT_COMMIT_SHA
"
\
--build-arg
GIT_CURRENT_BRANCH
=
"
$GIT_CURRENT_BRANCH
"
\
--build-arg
GIT_LAST_LOG_MESSAGE
=
"
$GIT_LAST_LOG_MESSAGE
"
\
--build-arg
GIT_LAST_COMMITTER
=
"
$GIT_LAST_COMMITTER
"
\
--build-arg
GIT_LAST_COMMIT_DATE
=
"
$GIT_LAST_COMMIT_DATE
"
\
--tag
"
${
REGISTRY
}
:
${
BUILD_IMAGE_TAG
}
"
\
"
${
IMAGE_OUTPUT
}
"
\
--file
Dockerfile
"
$SRCROOTDIR
"
echo
-e
"
\n
Done!
\n
Building instance image...
\n
"
echo
"APP_IMAGE_NAME=
$REGISTRY
:
$BUILD_IMAGE_TAG
"
>
app_docker_image_name.env
{
echo
"APP_IMAGE_VERSION=
$BUILD_IMAGE_TAG
"
}
>>
app_docker_image_name.env
popd
\ No newline at end of file
Loading