dockerfile

package
v1.0.4-0...-8bba0e1 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2017 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EmitComment

func EmitComment(out io.Writer, value string)

EmitComment writes a comment

func EmitInstruction

func EmitInstruction(out io.Writer, instruction, value string)

EmitInstruction writes an instruction

func Parse

func Parse(input io.Reader, file *Dockerfile, source ...string) (err error)

Convenience shortcut

func ParseFile

func ParseFile(name string, file *Dockerfile) (err error)

Convenience shortcut

Types

type Add

type Add struct {
	Line  int
	Paths string
}

func (*Add) Emit

func (a *Add) Emit(out io.Writer)

Emit writes ADD instructions

type Arg

type Arg struct {
	Line int
	Name string
}

func (*Arg) Emit

func (a *Arg) Emit(out io.Writer)

Emit writes ARG instructions

type Cmd

type Cmd struct {
	Line    int
	CmdLine string
}

func (*Cmd) Emit

func (c *Cmd) Emit(out io.Writer)

Emit writes CMD instructions

type Comment

type Comment struct {
	Line  int
	Lines string
}

func (*Comment) Emit

func (c *Comment) Emit(out io.Writer)

Emit writes comments

type Copy

type Copy struct {
	Line  int
	Paths string
}

func (*Copy) Emit

func (c *Copy) Emit(out io.Writer)

Emit writes COPY instructions

type Dockerfile

type Dockerfile struct {
	Source     string
	Statements []Statement
	From       *From
}

type Entrypoint

type Entrypoint struct {
	Line    int
	CmdLine string
}

func (*Entrypoint) Emit

func (e *Entrypoint) Emit(out io.Writer)

Emit writes ENTRYPOINT instructions

type Env

type Env struct {
	Line  int
	Pairs string
}

func (*Env) Emit

func (e *Env) Emit(out io.Writer)

Emit writes ENV instructions

type Expose

type Expose struct {
	Line  int
	Ports string
}

func (*Expose) Emit

func (e *Expose) Emit(out io.Writer)

Emit writes EXPOSE instructions

type From

type From struct {
	Line  int
	Image string
}

func (*From) Emit

func (f *From) Emit(out io.Writer)

Emit writes FROM instruction

type Healthcheck

type Healthcheck struct {
	Line    int
	Command string
}

func (*Healthcheck) Emit

func (h *Healthcheck) Emit(out io.Writer)

Emit writes HEALTHCHECK instructions

type Label

type Label struct {
	Line  int
	Pairs string
}

func (*Label) Emit

func (l *Label) Emit(out io.Writer)

Emit writes LABEL instructions

type Maintainer

type Maintainer struct {
	Line int
	Name string
}

func (*Maintainer) Emit

func (m *Maintainer) Emit(out io.Writer)

Emit writes MAINTAINER instructions

type Onbuild

type Onbuild struct {
	Line        int
	Instruction string
}

func (*Onbuild) Emit

func (o *Onbuild) Emit(out io.Writer)

Emit writes ONBUILD instructions

type Parser

type Parser struct {
	// contains filtered or unexported fields
}

func NewParser

func NewParser() *Parser

Creates a new parser

func (*Parser) Extend

func (p *Parser) Extend(name string, extension func(file *Dockerfile, line int, tokens *Tokens) Statement) *Parser

Extends parser. Example:

type Include struct {
  Line      int
  Reference string
}

parser.Extend("INCLUDE", func(file *Dockerfile, line int, tokens *Tokens) Statement {
  return &Include{Line: line, Reference: tokens.NextLine()}
})

func (*Parser) Parse

func (p *Parser) Parse(input io.Reader, file *Dockerfile, source ...string) (err error)

Parses a dockerfile from a reader. Returns an error if an unknown token is encountered.

func (*Parser) ParseFile

func (p *Parser) ParseFile(name string, file *Dockerfile) (err error)

Parses a dockerfile from a file. Returns an error if the file cannot be opened, is a directory or when parsing encounters an error

type Run

type Run struct {
	Line    int
	Command string
}

func (*Run) Emit

func (r *Run) Emit(out io.Writer)

Emit writes RUN instructions

type Shell

type Shell struct {
	Line    int
	CmdLine string
}

func (*Shell) Emit

func (s *Shell) Emit(out io.Writer)

Emit writes SHELL instructions

type Statement

type Statement interface {
	Emit(out io.Writer)
}

type Stopsignal

type Stopsignal struct {
	Line   int
	Signal string
}

func (*Stopsignal) Emit

func (s *Stopsignal) Emit(out io.Writer)

Emit writes STOPSIGNAL instructions

type Tokens

type Tokens struct {
	HasNext bool
	Line    int
	// contains filtered or unexported fields
}

func NewTokens

func NewTokens(r io.Reader) *Tokens

func (*Tokens) NextComment

func (t *Tokens) NextComment() string

func (*Tokens) NextLine

func (t *Tokens) NextLine() string

func (*Tokens) NextRune

func (t *Tokens) NextRune() rune

func (*Tokens) NextToken

func (t *Tokens) NextToken() string

type User

type User struct {
	Line int
	Name string
}

func (*User) Emit

func (u *User) Emit(out io.Writer)

Emit writes USER instructions

type Volume

type Volume struct {
	Line  int
	Names string
}

func (*Volume) Emit

func (v *Volume) Emit(out io.Writer)

Emit writes VOLUME instructions

type Workdir

type Workdir struct {
	Line int
	Path string
}

func (*Workdir) Emit

func (w *Workdir) Emit(out io.Writer)

Emit writes WORKDIR instructions

Jump to

Keyboard shortcuts

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