Add Feature to leverage custom command inside Docker.#Run
Signed-off-by: Sergio Maria Matone <sw360cab@gmail.com>
This commit is contained in:
parent
a693e19f13
commit
e6244aeedc
@ -214,6 +214,9 @@ import (
|
|||||||
// Container name
|
// Container name
|
||||||
name?: dagger.#Input & {string}
|
name?: dagger.#Input & {string}
|
||||||
|
|
||||||
|
// Custom Command overriding entrypoint of the Image
|
||||||
|
containerCommand?: dagger.#Input & {string}
|
||||||
|
|
||||||
// Recreate container?
|
// Recreate container?
|
||||||
recreate: dagger.#Input & {bool | *true}
|
recreate: dagger.#Input & {bool | *true}
|
||||||
|
|
||||||
@ -230,6 +233,7 @@ import (
|
|||||||
#command: #"""
|
#command: #"""
|
||||||
# Run detach container
|
# Run detach container
|
||||||
OPTS=""
|
OPTS=""
|
||||||
|
CMD=""
|
||||||
|
|
||||||
if [ ! -z "$CONTAINER_NAME" ]; then
|
if [ ! -z "$CONTAINER_NAME" ]; then
|
||||||
OPTS="$OPTS --name $CONTAINER_NAME"
|
OPTS="$OPTS --name $CONTAINER_NAME"
|
||||||
@ -250,7 +254,11 @@ import (
|
|||||||
OPTS="$OPTS -p $CONTAINER_PORTS"
|
OPTS="$OPTS -p $CONTAINER_PORTS"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
docker container run -d $OPTS "$IMAGE_REF"
|
if [ ! -z "$CONTAINER_CMD" ]; then
|
||||||
|
CMD="$CONTAINER_CMD"
|
||||||
|
fi
|
||||||
|
|
||||||
|
docker container run -d $OPTS "$IMAGE_REF" $CMD
|
||||||
"""#
|
"""#
|
||||||
|
|
||||||
run: #Command & {
|
run: #Command & {
|
||||||
@ -278,6 +286,11 @@ import (
|
|||||||
if ports != _|_ {
|
if ports != _|_ {
|
||||||
CONTAINER_PORTS: strings.Join(ports, " -p ")
|
CONTAINER_PORTS: strings.Join(ports, " -p ")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if containerCommand != _|_ {
|
||||||
|
CONTAINER_CMD: containerCommand
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user