summaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
Diffstat (limited to 'build')
-rw-r--r--build/instructions.go8
-rw-r--r--build/instructions_test.go6
-rw-r--r--build/phases.go1
3 files changed, 15 insertions, 0 deletions
diff --git a/build/instructions.go b/build/instructions.go
index 1b954a2..38ea322 100644
--- a/build/instructions.go
+++ b/build/instructions.go
@@ -80,6 +80,14 @@ func (env Env) Compile() []string {
return defs
}
+type Volume struct {
+ Path string
+}
+
+func (vol Volume) Compile() []string {
+ return []string{quote(vol.Path)}
+}
+
func quote(arg string) string {
return strconv.Quote(arg)
}
diff --git a/build/instructions_test.go b/build/instructions_test.go
index 8f9470c..04ebdfb 100644
--- a/build/instructions_test.go
+++ b/build/instructions_test.go
@@ -55,3 +55,9 @@ func TestEnv(t *testing.T) {
`quxname="quxvalue"`,
}, i.Compile())
}
+
+func TestVolume(t *testing.T) {
+ i := build.Volume{"/foo/dir"}
+
+ assert.Equal(t, []string{`"/foo/dir"`}, i.Compile())
+}
diff --git a/build/phases.go b/build/phases.go
index 095263c..02e84e4 100644
--- a/build/phases.go
+++ b/build/phases.go
@@ -6,6 +6,7 @@ const (
PhasePrivileged Phase = iota
PhasePrivilegeDropped
PhasePreInstall
+ PhaseInstall
PhasePostInstall
)