Skip to content

Commit

Permalink
allow rebuilding with a different base image
Browse files Browse the repository at this point in the history
  • Loading branch information
justone committed Dec 4, 2016
1 parent 57da874 commit 68e00fa
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
6 changes: 4 additions & 2 deletions api.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,10 @@ func RebuildEnvironment(dc DockerClient, sc SystemClient, co CreateOpts, output
co.Volumes = volumes

logrus.Debugf("Set image opts")
co.Build.Image = ImageOpts{
Image: env.Container.Labels["skeg.io/image/base"],
if len(co.Build.Image.Image) == 0 && len(co.Build.Image.Version) == 0 && len(co.Build.Image.Type) == 0 {
co.Build.Image = ImageOpts{
Image: env.Container.Labels["skeg.io/image/base"],
}
}

if len(co.Build.TimeZone) == 0 {
Expand Down
9 changes: 6 additions & 3 deletions rebuild.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ import (
)

type RebuildCommand struct {
BuildCommand
Ports []string `short:"p" long:"port" description:"Ports to expose (similar to docker -p)."`
Volumes []string `long:"volume" description:"Volume to mount (similar to docker -v)."`
ForceBuild bool `long:"force-build" description:"Force building of new user image."`
ForcePull bool `long:"force-pull" description:"Force pulling base image."`
TimeZone string `long:"tz" description:"Time zone for container, specify like 'America/Los_Angeles'. Defaults to UTC."`
Args struct {
Name string `description:"Name of environment."`
} `positional-args:"yes" required:"yes"`
Expand All @@ -23,7 +22,11 @@ func (ccommand *RebuildCommand) toCreateOpts(sc SystemClient) CreateOpts {
Volumes: ccommand.Volumes,
ForceBuild: ccommand.ForceBuild || ccommand.ForcePull,
Build: BuildOpts{
Image: ImageOpts{},
Image: ImageOpts{
Type: ccommand.Type,
Version: ccommand.Version,
Image: ccommand.Image,
},
TimeZone: ccommand.TimeZone,
ForcePull: ccommand.ForcePull,
Username: sc.Username(),
Expand Down

0 comments on commit 68e00fa

Please sign in to comment.