stdlib: docker: clean up docker.#Command inputs

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
Andrea Luzzardi 2021-10-12 17:10:46 -07:00
parent e5c571b8a9
commit 322997b74a
3 changed files with 18 additions and 29 deletions

View File

@ -31,10 +31,7 @@ A container image that can run any docker command
### docker.#Command Inputs ### docker.#Command Inputs
| Name | Type | Description | _No input._
| ------------- |:-------------: |:-------------: |
|*command* | `string` |Command to execute |
|*registries* | `[]` |Image registries |
### docker.#Command Outputs ### docker.#Command Outputs
@ -46,12 +43,10 @@ Load a docker image into a docker engine
### docker.#Load Inputs ### docker.#Load Inputs
| Name | Type | Description | | Name | Type | Description |
| ------------- |:-------------: |:-------------: | | ------------- |:-------------: |:-------------: |
|*tag* | `string` |Name and optionally a tag in the 'name:tag' format | |*tag* | `string` |Name and optionally a tag in the 'name:tag' format |
|*source* | `dagger.#Artifact` |Image source | |*source* | `dagger.#Artifact` |Image source |
|*load.command* | `"docker load -i /src/image.tar"` |Command to execute |
|*load.registries* | `[]` |Image registries |
### docker.#Load Outputs ### docker.#Load Outputs
@ -98,9 +93,7 @@ Push a docker image to a remote registry
| Name | Type | Description | | Name | Type | Description |
| ------------- |:-------------: |:-------------: | | ------------- |:-------------: |:-------------: |
|*ref* | `string` |Image reference (e.g: nginx:alpine) | |*ref* | `string` |Image reference (e.g: nginx:alpine) |
|*run.command* | `"""\n # Run detach container\n OPTS=""\n \n if [ ! -z "$CONTAINER_NAME" ]; then\n \tOPTS="$OPTS --name $CONTAINER_NAME"\n fi\n \n if [ ! -z "$CONTAINER_PORTS" ]; then\n \tOPTS="$OPTS -p $CONTAINER_PORTS"\n fi\n \n docker container run -d $OPTS "$IMAGE_REF"\n """` |Command to execute |
|*run.env.IMAGE_REF* | `string` |- | |*run.env.IMAGE_REF* | `string` |- |
|*run.registries* | `[]` |Image registries |
### docker.#Run Outputs ### docker.#Run Outputs

View File

@ -14,14 +14,10 @@ import "alpha.dagger.io/docker/compose"
### compose.#App Inputs ### compose.#App Inputs
| Name | Type | Description | | Name | Type | Description |
| ------------- |:-------------: |:-------------: | | ------------- |:-------------: |:-------------: |
|*name* | `*"source" \| string` |App name (use as COMPOSE_PROJECT_NAME) | |*name* | `*"source" \| string` |App name (use as COMPOSE_PROJECT_NAME) |
|*registries* | `[]` |Image registries | |*registries* | `[]` |Image registries |
|*run.command* | `"""\n if [ -n "$DOCKER_HOSTNAME" ]; then\n \tssh -i /key -fNT -o "StreamLocalBindUnlink=yes" -L "$(pwd)"/docker.sock:/var/run/docker.sock -p "$DOCKER_PORT" "$DOCKER_USERNAME"@"$DOCKER_HOSTNAME"\n \texport DOCKER_HOST="unix://$(pwd)/docker.sock"\n fi\n \n # Extend session duration\n echo "Host *\\nServerAliveInterval 240" \>\> "$HOME"/.ssh/config\n chmod 600 "$HOME"/.ssh/config\n \n # Move compose\n if [ -d "$SOURCE_DIR" ]; then\n \tif [ -f docker-compose.yaml ]; then\n \t\tcp docker-compose.yaml "$SOURCE_DIR"/docker-compose.yaml\n \tfi\n \tcd "$SOURCE_DIR"\n fi\n \n docker-compose build\n docker-compose up -d\n """` |Command to execute |
|*run.env.COMPOSE_PROJECT_NAME* | `*"source" \| string` |- |
|*run.package."docker-compose"* | `true` |- |
|*run.registries* | `[]` |Image registries |
### compose.#App Outputs ### compose.#App Outputs

View File

@ -31,11 +31,11 @@ import (
} }
// Command to execute // Command to execute
command: string @dagger(input) command: string
// Environment variables shared by all commands // Environment variables shared by all commands
env: { env: {
[string]: string @dagger(input) [string]: string
} }
// Mount content from other artifacts // Mount content from other artifacts
@ -44,17 +44,17 @@ import (
from: dagger.#Artifact from: dagger.#Artifact
} | { } | {
secret: dagger.#Secret secret: dagger.#Secret
} @dagger(input) }
} }
// Mount persistent cache directories // Mount persistent cache directories
cache: { cache: {
[string]: true @dagger(input) [string]: true
} }
// Mount temporary directories // Mount temporary directories
tmpfs: { tmpfs: {
[string]: true @dagger(input) [string]: true
} }
// Mount docker socket // Mount docker socket
@ -62,7 +62,7 @@ import (
// Additional packages to install // Additional packages to install
package: { package: {
[string]: true | false | string @dagger(input) [string]: true | false | string
} }
// Image registries // Image registries
@ -70,7 +70,7 @@ import (
target?: string target?: string
username: string username: string
secret: dagger.#Secret secret: dagger.#Secret
}] @dagger(input) }]
// Copy contents from other artifacts // Copy contents from other artifacts
copy: [string]: from: dagger.#Artifact copy: [string]: from: dagger.#Artifact
@ -98,7 +98,7 @@ import (
ssh-add /key > /dev/null ssh-add /key > /dev/null
if [ "$?" != 0 ]; then if [ "$?" != 0 ]; then
exit 1 exit 1
fi fi
fi fi
if [[ ! -z $FINGERPRINT ]]; then if [[ ! -z $FINGERPRINT ]]; then
@ -131,7 +131,7 @@ import (
for registry in registries { for registry in registries {
op.#Exec & { op.#Exec & {
args: ["/bin/bash", "-c", #""" args: ["/bin/bash", "-c", #"""
echo "$TARGER_HOST" | docker login --username "$DOCKER_USERNAME" --password-stdin "$(cat /password)" echo "$TARGER_HOST" | docker login --username "$DOCKER_USERNAME" --password-stdin "$(cat /password)"
"""#, """#,
] ]
env: { env: {