Skip to content

Commit 8470053

Browse files
authored
Do not generate dockerfile on shell command (#54)
## Summary Do not generate dockerfile on shell command, as someone who is using the shell command may not need to use language detector, or need to fill in `install`, `build` and `start` command if the language planner is absent. ## How was it tested? devbox shell devbox generate devbox build
1 parent e472379 commit 8470053

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

devbox.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,14 @@ func (d *Devbox) Plan() *planner.Plan {
9898
// the devbox environment.
9999
func (d *Devbox) Generate() error {
100100
plan := d.Plan()
101-
return generate(d.srcDir, plan)
101+
return generate(d.srcDir, plan, append(shellFiles, buildFiles...))
102102
}
103103

104104
// Shell generates the devbox environment and launches nix-shell as a child
105105
// process.
106106
func (d *Devbox) Shell() error {
107-
err := d.Generate()
107+
plan := d.Plan()
108+
err := generate(d.srcDir, plan, shellFiles)
108109
if err != nil {
109110
return errors.WithStack(err)
110111
}

generate.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@ import (
1818
//go:embed tmpl/* tmpl/.*
1919
var tmplFS embed.FS
2020

21-
func generate(rootPath string, plan *planner.Plan) error {
22-
// TODO: we should also generate a .dockerignore file
23-
files := []string{".gitignore", "Dockerfile", "shell.nix", "default.nix"}
21+
var shellFiles = []string{".gitignore", "shell.nix"}
2422

23+
// TODO: we should also generate a .dockerignore file
24+
var buildFiles = []string{".gitignore", "default.nix", "Dockerfile"}
25+
26+
func generate(rootPath string, plan *planner.Plan, files []string) error {
2527
outPath := filepath.Join(rootPath, ".devbox/gen")
2628

2729
for _, file := range files {

0 commit comments

Comments
 (0)