docker_render

package module
v0.0.0-...-3444c05 Latest Latest
Warning

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

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

README

docker render

Install the Docker plugin

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

make install

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run() error

func ShowPluginMetaData

func ShowPluginMetaData() bool

Types

type PluginMetadata

type PluginMetadata struct {
	SchemaVersion    string `json:"SchemaVersion"`
	Vendor           string `json:"Vendor"`
	Version          string `json:"Version"`
	ShortDescription string `json:"ShortDescription"`
	URL              string `json:"Url"`
	Experimental     bool   `json:"Experimental"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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