Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
clive
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
clive
Commits
b0ff70e6
Verified
Commit
b0ff70e6
authored
1 year ago
by
Mateusz Żebrak
Browse files
Options
Downloads
Patches
Plain Diff
Build docker images with clive CLI entrypoint
parent
9795b613
No related branches found
No related tags found
3 merge requests
!186
V1.27.5.0 release
,
!174
RELEASE: 1
,
!165
Update submodule to hive!1012
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
.gitlab-ci.yml
+20
-0
20 additions, 0 deletions
.gitlab-ci.yml
docker/Dockerfile
+10
-2
10 additions, 2 deletions
docker/Dockerfile
docker/entrypoint.sh
+42
-0
42 additions, 0 deletions
docker/entrypoint.sh
scripts/ci-helpers/build_instance.sh
+10
-1
10 additions, 1 deletion
scripts/ci-helpers/build_instance.sh
with
82 additions
and
3 deletions
.gitlab-ci.yml
+
20
−
0
View file @
b0ff70e6
...
...
@@ -181,6 +181,11 @@ testing_clive:
build_and_push_clive_image
:
extends
:
.prepare_clive_image
build_and_push_clive_cli_image
:
extends
:
build_and_push_clive_image
variables
:
BUILD_INSTANCE_ARGS
:
"
--interactive-cli"
build_and_push_clive_testnet_image
:
extends
:
.prepare_clive_image
<<
:
*clive_testnet_needs
...
...
@@ -188,6 +193,11 @@ build_and_push_clive_testnet_image:
BASE_IMAGE
:
${HIVED_IMAGE_NAME}
BUILD_INSTANCE_ARGS
:
"
--embedded-testnet"
build_and_push_clive_cli_testnet_image
:
extends
:
build_and_push_clive_testnet_image
variables
:
BUILD_INSTANCE_ARGS
:
"
--embedded-testnet
--interactive-cli"
.prepare_clive_stable_image
:
extends
:
.prepare_clive_image
when
:
on_success
...
...
@@ -207,6 +217,11 @@ build_and_push_clive_testnet_image:
build_and_push_clive_stable_image
:
extends
:
.prepare_clive_stable_image
build_and_push_clive_cli_stable_image
:
extends
:
build_and_push_clive_stable_image
variables
:
BUILD_INSTANCE_ARGS
:
"
--interactive-cli"
build_and_push_clive_stable_testnet_image
:
extends
:
.prepare_clive_stable_image
<<
:
*clive_testnet_needs
...
...
@@ -214,4 +229,9 @@ build_and_push_clive_stable_testnet_image:
BASE_IMAGE
:
${HIVED_IMAGE_NAME}
BUILD_INSTANCE_ARGS
:
"
--embedded-testnet
--image-path-suffix=-${CI_COMMIT_REF_NAME}"
build_and_push_clive_cli_stable_testnet_image
:
extends
:
build_and_push_clive_stable_testnet_image
variables
:
BUILD_INSTANCE_ARGS
:
"
--embedded-testnet
--image-path-suffix=-${CI_COMMIT_REF_NAME}
--interactive-cli"
#<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<| BUILD DOCKER |<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
This diff is collapsed.
Click to expand it.
docker/Dockerfile
+
10
−
2
View file @
b0ff70e6
...
...
@@ -9,6 +9,7 @@ FROM $BASE_IMAGE AS instance
SHELL
["/bin/bash", "-c"]
ADD
--chown=hived_admin:users ./docker/entrypoint.sh .
ADD
--chown=hived_admin:users . /clive
WORKDIR
/clive
...
...
@@ -22,7 +23,12 @@ RUN poetry self update && \
# crucial for proper display
ENV
COLORTERM=truecolor
ENTRYPOINT
["poetry", "run", "clive"]
ARG
INTERACTIVE_CLI_MODE=0
ENV
INTERACTIVE_CLI_MODE=${INTERACTIVE_CLI_MODE}
ENV
TESTNET_MODE=0
ENTRYPOINT
["/home/hived_admin/entrypoint.sh"]
# this target should be built using a testnet hived image as a base (to have embedded testnet)
FROM
instance
as
embedded_testnet_instance
...
...
@@ -43,4 +49,6 @@ WORKDIR /clive
# Run installation once again to supplement extras and development dependencies
RUN
poetry
install
ENTRYPOINT
["poetry", "run", "python", "testnet_node.py"]
ENV
TESTNET_MODE=1
ENTRYPOINT
["/home/hived_admin/entrypoint.sh"]
This diff is collapsed.
Click to expand it.
docker/entrypoint.sh
0 → 100755
+
42
−
0
View file @
b0ff70e6
#! /bin/bash
set
-euo
pipefail
TESTNET_NODE_LOG_FILE
=
testnet_node.log
wait_for_testnet
()
{
LIMIT
=
120
# seconds
TARGET_SUBSTRING
=
"Serving forever"
COMMAND
=
"( tail -f -n0
${
TESTNET_NODE_LOG_FILE
}
& ) | grep -q '
${
TARGET_SUBSTRING
}
'"
echo
"Waiting for testnet node to be ready..."
timeout
$LIMIT
bash
-c
"
${
COMMAND
}
"
echo
"Testnet node is ready to use"
}
echo
"TESTNET_MODE=
${
TESTNET_MODE
}
"
echo
"INTERACTIVE_CLI_MODE=
${
INTERACTIVE_CLI_MODE
}
"
# Activate the virtual environment
source
$(
poetry
env
info
--path
)
/bin/activate
if
[
"
${
TESTNET_MODE
}
"
=
"0"
]
;
then
if
[
"
${
INTERACTIVE_CLI_MODE
}
"
=
"0"
]
;
then
echo
"Launching clive in TUI mode on mainnet"
clive
else
echo
"Launching clive in CLI mode on mainnet"
bash
fi
else
if
[
"
${
INTERACTIVE_CLI_MODE
}
"
=
"0"
]
;
then
echo
"Launching clive in TUI mode on testnet"
python3 testnet_node.py
else
echo
"Launching clive in CLI mode on testnet"
python3 testnet_node.py
--no-tui
>
${
TESTNET_NODE_LOG_FILE
}
2>&1 &
wait_for_testnet
bash
fi
fi
This diff is collapsed.
Click to expand it.
scripts/ci-helpers/build_instance.sh
+
10
−
1
View file @
b0ff70e6
...
...
@@ -12,6 +12,7 @@ REGISTRY=""
SRCROOTDIR
=
""
IMAGE_TAG_PREFIX
=
""
IMAGE_TAG_CLI
=
""
IMAGE_PATH_SUFFIX
=
""
BEEKEEPER_IMAGE
=
""
...
...
@@ -19,6 +20,8 @@ BASE_IMAGE=""
DOCKER_TARGET
=
"instance"
INTERACTIVE_CLI_MODE
=
0
print_help
()
{
echo
"Usage:
$0
<image_tag> <src_dir> <registry_url> [OPTION[=VALUE]]..."
echo
...
...
@@ -27,6 +30,7 @@ print_help () {
echo
" --beekeeper-source-image=image_name Allows to specify image name containing a prebuilt beekeper tool"
echo
" --base-image=image_name Allows to specify an image name being use as a base of the one to be built"
echo
" --embedded-testnet Allows to build a clive image having embedded a hived testnet inside (ready for immediate sanboxing run)"
echo
" --interactive-cli Allows to build a clive image having interactive CLI mode ready to use"
echo
" --image-path-suffix Allows to specify a suffix to be added to the image path, to organize images in a more structured directory-like way"
echo
" --help Display this help screen and exit"
echo
...
...
@@ -46,6 +50,10 @@ while [ $# -gt 0 ]; do
DOCKER_TARGET
=
"embedded_testnet_instance"
IMAGE_TAG_PREFIX
=
"testnet-"
;;
--interactive-cli
)
INTERACTIVE_CLI_MODE
=
1
IMAGE_TAG_CLI
=
"cli-"
;;
--image-path-suffix
=
*
)
IMAGE_PATH_SUFFIX
=
"
${
1
#*=
}
"
;;
...
...
@@ -90,7 +98,7 @@ pushd "$SRCROOTDIR"
export
DOCKER_BUILDKIT
=
1
CLIVE_IMAGE_TAG_PREFIX
=
"
${
IMAGE_TAG_PREFIX
}
instance"
CLIVE_IMAGE_TAG_PREFIX
=
"
${
IMAGE_TAG_PREFIX
}
${
IMAGE_TAG_CLI
}
instance"
CLIVE_IMAGE_PATH
=
"
${
REGISTRY
}${
CLIVE_IMAGE_TAG_PREFIX
}${
IMAGE_PATH_SUFFIX
}
"
CLIVE_IMAGE_NAME
=
"
${
CLIVE_IMAGE_PATH
}
:
${
CLIVE_IMAGE_TAG_PREFIX
}
-
${
BUILD_IMAGE_TAG
}
"
...
...
@@ -98,6 +106,7 @@ docker build --target=${DOCKER_TARGET} \
--build-arg
CI_REGISTRY_IMAGE
=
$REGISTRY
\
--build-arg
BASE_IMAGE
=
${
BASE_IMAGE
}
\
--build-arg
BEEKEEPER_IMAGE
=
${
BEEKEEPER_IMAGE
}
\
--build-arg
INTERACTIVE_CLI_MODE
=
${
INTERACTIVE_CLI_MODE
}
\
-t
${
CLIVE_IMAGE_NAME
}
\
-f
docker/Dockerfile
.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment