Documentation ¶
Index ¶
- type Docen
- func (d *Docen) GenerateDockerfile() error
- func (d *Docen) SetAdditionalFile(path string) *Docen
- func (d *Docen) SetAdditionalFolder(path string) *Docen
- func (d *Docen) SetGoVersion(version string) *Docen
- func (d *Docen) SetPort(port string) *Docen
- func (d *Docen) SetTestMode(mode bool) *Docen
- func (d *Docen) SetTimezone(timezone string) *Docen
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Docen ¶
type Docen struct {
// contains filtered or unexported fields
}
func New ¶
func New() *Docen
New method creates new instance of generator. By default, the golang version is taken from runtime.Version By default, additional folders are `static`, `templates`, `config` and `assets`.
Example ¶
err := docen.New(). SetGoVersion("1.14.9"). SetPort("3000"). SetTimezone("Europe/Moscow"). SetTestMode(true). SetAdditionalFolder("my-folder/some-files"). SetAdditionalFile("another-folder/some-files/file"). GenerateDockerfile() if err != nil { log.Fatal(err) }
Output:
func (*Docen) GenerateDockerfile ¶
GenerateDockerfile method creates Dockerfile file. If vendor mode is enabled then building will be with `-mod=vendor` tag.
Example ¶
err := docen.New().GenerateDockerfile() if err != nil { log.Fatal(err) }
Output:
func (*Docen) SetAdditionalFile ¶
SetAdditionalFolder method allows you to set additional files which will be added to a container.
Example ¶
docen.New().SetAdditionalFile("my-folder/some-files/file")
Output:
func (*Docen) SetAdditionalFolder ¶
SetAdditionalFolder method allows you to set additional folders which will be added to a container.
Example ¶
docen.New().SetAdditionalFolder("my-folder/some-files")
Output:
func (*Docen) SetGoVersion ¶
SetGoVersion method allows you to set a specific version of golang.
Example ¶
docen.New().SetGoVersion("1.14.9")
Output:
func (*Docen) SetPort ¶
SetPort method allows you to set an exposed port. It can be as single port as a range of ports.
Example ¶
docen.New().SetPort("3000-4000")
Output:
func (*Docen) SetTestMode ¶
SetTestMode method allows you to enable testing before starting to build the app.
Example ¶
docen.New().SetTestMode(true)
Output: