Skip to content

Commit

Permalink
pass source to nixpacks (#2)
Browse files Browse the repository at this point in the history
* pass source to `nixpacks`

* default source to `src.Path`
  • Loading branch information
thiskevinwang authored Feb 12, 2023
1 parent 6a920e5 commit f9013ac
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions builder/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ func (b *Builder) BuildFunc() interface{} {
}

const (
DEFAULT_SOURCE = "./"
DEFAULT_PLATFORM = "linux/amd64"
)

Expand All @@ -55,13 +54,16 @@ func (b *Builder) Build(

// set config defaults
if b.config.Source == "" {
b.config.Source = DEFAULT_SOURCE
// this should be the directory where the waypoint.hcl file is located
b.config.Source = src.Path
}

if b.config.Platform == "" {
b.config.Platform = DEFAULT_PLATFORM
}

log.Info("config values", "source", b.config.Source, "platform", b.config.Platform)

// check for nixpack
nixpacksPath, err := exec.LookPath("nixpacks")
if err != nil {
Expand All @@ -72,7 +74,7 @@ func (b *Builder) Build(
u.Step(terminal.StatusOK, fmt.Sprintf("Nixpacks installed at: %q", nixpacksPath))

cmd := exec.Command(nixpacksPath,
"build", ".",
"build", b.config.Source,
"--platform", b.config.Platform,
"--name", fmt.Sprintf("waypoint.local/%s", src.App))

Expand Down

0 comments on commit f9013ac

Please sign in to comment.