added ports to docker.#Run
Signed-off-by: Richard Jones <richard@dagger.io>
This commit is contained in:
parent
61c7837734
commit
9f16bcdadb
@ -2,6 +2,7 @@
|
||||
package docker
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"alpha.dagger.io/dagger"
|
||||
"alpha.dagger.io/dagger/op"
|
||||
)
|
||||
@ -138,6 +139,9 @@ import (
|
||||
secret: dagger.#Secret
|
||||
} & dagger.#Input
|
||||
|
||||
// local ports
|
||||
ports?: [...string]
|
||||
|
||||
#command: #"""
|
||||
# Run detach container
|
||||
OPTS=""
|
||||
@ -146,6 +150,10 @@ import (
|
||||
OPTS="$OPTS --name $CONTAINER_NAME"
|
||||
fi
|
||||
|
||||
if [ ! -z "$CONTAINER_PORTS" ]; then
|
||||
OPTS="$OPTS -p $CONTAINER_PORTS"
|
||||
fi
|
||||
|
||||
docker container run -d $OPTS "$IMAGE_REF"
|
||||
"""#
|
||||
|
||||
@ -163,6 +171,10 @@ import (
|
||||
if name != _|_ {
|
||||
CONTAINER_NAME: name
|
||||
}
|
||||
|
||||
if ports != _|_ {
|
||||
CONTAINER_PORTS: strings.Join(ports," -p ")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user