render

command module
v0.0.0-...-4f6d7dc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 25, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

README

docker render

Install the Docker plugin

Use the following command to install the Docker plugin in your current Docker CLI installation

make install-plugins

Test the installation using docker render from your Terminal.

Usage

Once you've installed the Docker plugin you can use as following

docker render [OPTIONS] <context_path>

With the following options:

Name Description Required Default value
file-name The name of the template file False Dockerfile.template
output The name of the outputfile, if it's an empty string the result will be printed on stdout False
values The path for the values file. If an absolute path is passed context path will be ignored. Otherwise it will be joined to the conext path False docker-values.yaml

Example

Once you've installed the Docker plugin you can follow the below steps:

  • Create a Dockerfile.template with the following content
    # Use an official base image
    FROM {{.BaseImage}}
    
    # Set the exposed port
    EXPOSE {{.Deployment.ExposedPort}}
    
    # Set environment variables
    {{range .Deployment.Environment}}
    ENV {{.Name}}="{{.Value}}"
    {{end}}
    
    # Copy source code
    COPY . {{.CopyDestination}}
    
    # Run command
    CMD {{.RunCommand}}
    
  • Create a docker-values.yaml file with the following content:
    BaseImage: "ubuntu:latest"
    Deployment:
    ExposedPort: "9091"
    Environment:
        - Name: "DEBUG"
        Value: "false"
        - Name: "LOG_LEVEL"
        Value: "info"
    CopyDestination: "/app"
    RunCommand: "echo Hello World"
    
  • Create the Dockerfile with
    docker render -output Dockerfile .
    
  • Build the Docker image
    docker build . -t rendered-docker-image
    
  • Run the container
    docker run -it rendered-docker-image
    
    This shoould output Hello World on your terminal.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL