Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gendl
gendl
Commits
bd875e77
Commit
bd875e77
authored
Oct 25, 2021
by
Dave Cooper
Browse files
try to name container based on branch
parent
39885076
Pipeline
#5201
failed with stages
in 22 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
docker/build
View file @
bd875e77
...
...
@@ -10,6 +10,22 @@
#
set
-
e
echo
"CI_BUILD_REF_NAME is: ${CI_BUILD_REF_NAME}"
if
[
-
z
"${CI_BUILD_REF_NAME}"
];
then
branch
=
"unspecified"
else
branch
=
$
{
CI_BUILD_REF_NAME
//
\
//--
}
fi
echo
"branch is: ${branch}"
cd
`dirname $0`
/
..
/
..
/
echo
"Present Working Directory: "
`pwd`
...
...
@@ -45,9 +61,9 @@ rm ${dist_name}.zip
mv
$
{
dist_name
}
gendl
-
build
/
docker
build
-
t
dcooper8
/
gendl
:
latest
-
f
.
/
gendl
/
docker
/
Dockerfile
.
docker
build
-
t
dcooper8
/
gendl
:
$
{
branch
}
-
f
.
/
gendl
/
docker
/
Dockerfile
.
rm
-
rf
gendl
-
build
/
docker
push
dcooper8
/
gendl
:
latest
docker
push
dcooper8
/
gendl
:
$
{
branch
}
docker/run
View file @
bd875e77
...
...
@@ -17,15 +17,29 @@
# Note gendl source home is being mounted from: ${gendl} to /home/${gendl_user}/gendl/ in the container.
#
# FLAG orig
#CID=$(docker run -d -it --rm -p 9000:9000 -p 4200:4200 -h gendl \
# --name gendl --mount type=bind,src=${gendl},dst=/home/${gendl_user}/gendl/ dcooper8/gendl:latest)
# CID=$(docker run -d -it --rm -p 9000:9000 -p 4200:4200 -h gendl --name gendl dcooper8/gendl:latest) # works.
CURRDIR
=
`
dirname
$0
`
GENDL_SRC
=
"
`
cd
"
${
CURRDIR
}
/.."
;
pwd
`
"
echo
"GENDL_SRC is
$GENDL_SRC
"
pushd
.
cd
$GENDL_SRC
branch
=
$(
git rev-parse
--abbrev-ref
HEAD 2>/dev/null
)
ret_code
=
$?
branch
=
${
branch
//\//--
}
if
[
"
$ret_code
"
-ne
"0"
]
;
then
branch
=
"unspecified"
fi
# CID=$(docker run -d -it --rm dcooper8/gendl:latest) # starts but hangs (bad). No port 4200.
CID
=
$(
docker run
-id
--rm
-h
gendl
--name
gendl
-p
9000:9000
-p
4200:4200 dcooper8/gendl:
latest
)
# works.
CID
=
$(
docker run
-id
--rm
-h
gendl
--name
gendl
-p
9000:9000
-p
4200:4200 dcooper8/gendl:
${
branch
}
)
...
...
@@ -40,3 +54,4 @@ else
echo
${
CID
}
fi
popd
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment