Skip to content

Instantly share code, notes, and snippets.

@lucymhdavies
Created January 24, 2018 19:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lucymhdavies/2a2cac733cb99d87d7087f37182715dd to your computer and use it in GitHub Desktop.
Save lucymhdavies/2a2cac733cb99d87d7087f37182715dd to your computer and use it in GitHub Desktop.
package cmd
import (
"github.com/docker/go-connections/nat"
"github.com/skybet/cali"
)
func init() {
command := cli.NewCommand("rake")
command.SetShort("Run rake preview")
command.SetLong(`Starts a container and runs rake preview.
Examples:
To render the site locally.
# staticli rake
Any addtional flags sent to the rake command come after the --, e.g.
# staticli rake preview -- --future
`)
command.Flags().StringP("port", "p", "4000", "Port to expose on host")
command.BindFlags()
task := command.Task("kaerast/rake-preview")
task.SetInitFunc(func(t *cali.Task, args []string) {
task.HostConf.PortBindings = nat.PortMap{
nat.Port("4000/tcp"): []nat.PortBinding{
{HostIP: "0.0.0.0", HostPort: cli.FlagValues().GetString("port")},
},
}
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment