Created
January 24, 2018 19:59
-
-
Save lucymhdavies/2a2cac733cb99d87d7087f37182715dd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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