Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions api/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ func toContainerResult(container ContainerResult) (ContainerResult, error) {
AutoScaling: autoScaling,
Locked: container.Locked,
State: container.State,
Command: container.Command,
Entrypoint: container.Entrypoint,
}, nil
}

Expand Down
91 changes: 91 additions & 0 deletions api/generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions cmd/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ var createContainerCmd = &cobra.Command{
resources, _ := cmd.Flags().GetString("resources")
environmentVariables, _ := cmd.Flags().GetStringArray("env")
secrets, _ := cmd.Flags().GetStringArray("secret")
command, _ := cmd.Flags().GetStringArray("command")
entrypoint, _ := cmd.Flags().GetStringArray("entrypoint")

envs := append(envsToApi(environmentVariables, false, api.StatePresent), envsToApi(secrets, true, api.StatePresent)...)

Expand All @@ -87,6 +89,8 @@ var createContainerCmd = &cobra.Command{
Resources: api.ContainerResources(resources),
Image: image,
EnvironmentVariables: envs,
Entrypoint: entrypoint,
Command: command,
Mounts: []api.MountInput{},
Ports: []string{},
Ingresses: []api.IngressInput{},
Expand Down Expand Up @@ -115,6 +119,8 @@ var createStarterContainerCmd = &cobra.Command{
image, _ := cmd.Flags().GetString("image")
environmentVariables, _ := cmd.Flags().GetStringArray("env")
secrets, _ := cmd.Flags().GetStringArray("secret")
command, _ := cmd.Flags().GetStringArray("command")
entrypoint, _ := cmd.Flags().GetStringArray("entrypoint")

envs := append(envsToApi(environmentVariables, false, api.StatePresent), envsToApi(secrets, true, api.StatePresent)...)

Expand All @@ -124,6 +130,8 @@ var createStarterContainerCmd = &cobra.Command{
Resources: api.ContainerResourcesCpu250Ram500,
Image: image,
EnvironmentVariables: envs,
Entrypoint: entrypoint,
Command: command,
Mounts: []api.MountInput{},
Ports: []string{},
Ingresses: []api.IngressInput{},
Expand Down Expand Up @@ -156,6 +164,8 @@ var modifyContainerCmd = &cobra.Command{
removedEnvironmentVariables, _ := cmd.Flags().GetStringArray("remove-env")
registry, _ := cmd.Flags().GetString("registry")
removeRegistry, _ := cmd.Flags().GetBool("remove-registry")
command, _ := cmd.Flags().GetStringArray("command")
entrypoint, _ := cmd.Flags().GetStringArray("entrypoint")

client := api.NewClient()

Expand Down Expand Up @@ -199,6 +209,14 @@ var modifyContainerCmd = &cobra.Command{
input.Resources = &resources
}

if len(command) > 0 {
input.Command = command
}

if len(entrypoint) > 0 {
input.Entrypoint = entrypoint
}

container, err := client.ContainerModify(input)
if err != nil {
log.Fatalf("Failed to modify container: %v", err)
Expand Down Expand Up @@ -242,13 +260,17 @@ func init() {
createContainerCmd.MarkFlagRequired("namespace")
createContainerCmd.MarkFlagRequired("name")
createContainerCmd.MarkFlagRequired("image")
createContainerCmd.Flags().StringArray("entrypoint", []string{}, "Entrypoint for the container")
createContainerCmd.Flags().StringArray("command", []string{}, "Command to run in the container")
containerCmd.AddCommand(createContainerCmd)

createStarterContainerCmd.Flags().String("namespace", "", "Namespace")
createStarterContainerCmd.Flags().String("name", "", "Name for the container")
createStarterContainerCmd.Flags().String("image", "", "Container image")
createStarterContainerCmd.Flags().StringArray("env", []string{}, "Container environment variables")
createStarterContainerCmd.Flags().StringArray("secret", []string{}, "Container secrets")
createStarterContainerCmd.Flags().StringArray("entrypoint", []string{}, "Entrypoint for the container")
createStarterContainerCmd.Flags().StringArray("command", []string{}, "Command to run in the container")
createStarterContainerCmd.MarkFlagRequired("namespace")
createStarterContainerCmd.MarkFlagRequired("name")
createStarterContainerCmd.MarkFlagRequired("image")
Expand All @@ -258,6 +280,8 @@ func init() {
modifyContainerCmd.Flags().String("name", "", "Name for the container")
modifyContainerCmd.Flags().String("image", "", "Container image")
modifyContainerCmd.Flags().String("resources", "", "Container resources")
modifyContainerCmd.Flags().StringArray("command", []string{}, "Command to run in the container")
modifyContainerCmd.Flags().StringArray("entrypoint", []string{}, "Entrypoint for the container")
modifyContainerCmd.Flags().StringArray("env", []string{}, "Container environment variables")
modifyContainerCmd.Flags().StringArray("secret", []string{}, "Container secrets")
modifyContainerCmd.Flags().StringArray("remove-env", []string{}, "Container remove environment variables")
Expand Down
2 changes: 2 additions & 0 deletions operations/Container.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ fragment ContainerResult on Container {
name
}
resources
command
entrypoint
# @genqlient(flatten: true)
environmentVariables {
... EnvironmentVariableResult
Expand Down
60 changes: 60 additions & 0 deletions schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,11 @@ input ConfigureContainerInput {
type Container {
autoScaling: AutoScaling
availableReplicas: Int!
command: [String!]
containerType: ContainerType! @deprecated(reason: "use `type` instead")
createdAt: DateTime!
deletedAt: DateTime @deprecated(reason: "this field will be removed in the future, and doesn't have a replacement")
entrypoint: [String!]
environmentVariables: [EnvironmentVariable!]!
healthCheck: HealthCheck
id: ID!
Expand Down Expand Up @@ -302,6 +304,35 @@ input ContainerCreateInput {

""
type: ContainerType! = DEFAULT

"""
Entrypoint of the container.
This field will overwrite the default entrypoint of the image. When the field is omitted, the default entrypoint of the image will be used.

Null will reset the command to the default.

Entry point is the first command executed when the container starts. It will receive the command as arguments.
For example when the entrypoint is `python`, the command `app.py` will be executed as `python app.py`.

This field is defined in docker exec format. https://docs.docker.com/reference/dockerfile/#shell-and-exec-form
"""
entrypoint: [String!]

"""
Command to run.
This is the command executed at the given schedule.
When the field is omitted, the default command of the image will be used.

Null will reset the command to the default.
The command will be passed to the entrypoint as arguments. Use quotes to pass an argument with spaces.

Environment variables can be used in the command by using the syntax `$(ENVIRONMENT_VARIABLE)`.

Example: `echo "Hello $(NAME)"`.

This field is defined in docker exec format. https://docs.docker.com/reference/dockerfile/#shell-and-exec-form
"""
command: [String!]
}

input ContainerDeleteInput {
Expand Down Expand Up @@ -510,6 +541,35 @@ input ContainerModifyInput {
current health check unchanged you can omit this field.
"""
healthCheck: HealthCheckInput

"""
Entrypoint of the container.
This field will overwrite the default entrypoint of the image. When the field is omitted, the default entrypoint of the image will be used.

Null will reset the command to the default.

Entry point is the first command executed when the container starts. It will receive the command as arguments.
For example when the entrypoint is `python`, the command `app.py` will be executed as `python app.py`.

This field is defined in docker exec format. https://docs.docker.com/reference/dockerfile/#shell-and-exec-form
"""
entrypoint: [String!]

"""
Command to run.
This is the command executed at the given schedule.
When the field is omitted, the default command of the image will be used.

Null will reset the command to the default.
The command will be passed to the entrypoint as arguments. Use quotes to pass an argument with spaces.

Environment variables can be used in the command by using the syntax `$(ENVIRONMENT_VARIABLE)`.

Example: `echo "Hello $(NAME)"`.

This field is defined in docker exec format. https://docs.docker.com/reference/dockerfile/#shell-and-exec-form
"""
command: [String!]
}

input ContainerResourceInput {
Expand Down
Loading