summaryrefslogtreecommitdiff
path: root/build/instructions.go
diff options
context:
space:
mode:
Diffstat (limited to 'build/instructions.go')
-rw-r--r--build/instructions.go29
1 files changed, 29 insertions, 0 deletions
diff --git a/build/instructions.go b/build/instructions.go
index 3035b9f..91caa6b 100644
--- a/build/instructions.go
+++ b/build/instructions.go
@@ -78,6 +78,22 @@ func (copy Copy) Compile() []string {
return append(quoteAll(copy.Sources), quote(copy.Destination))
}
+// CopyAs is a concrete build instruction for copying source
+// files/directories and setting their ownership to the given UID/GID.
+//
+type CopyAs struct {
+ UID uint // owner UID
+ GID uint // owner GID
+ Copy
+}
+
+// Compile returns the variant name unquoted and all quoted CopyAs instruction
+// fields.
+//
+func (ca CopyAs) Compile() []string {
+ return append([]string{fmt.Sprintf("%d:%d", ca.UID, ca.GID)}, ca.Copy.Compile()...)
+}
+
// CopyFrom is a concrete build instruction for copying source
// files/directories from one variant image to another.
//
@@ -121,6 +137,19 @@ func (label Label) Compile() []string {
return compileSortedKeyValues(label.Definitions)
}
+// User is a build instruction for setting which user will run future
+// commands.
+//
+type User struct {
+ Name string // user name
+}
+
+// Compile returns the quoted user name.
+//
+func (user User) Compile() []string {
+ return []string{quote(user.Name)}
+}
+
// Volume is a concrete build instruction for defining a volume mount point
// within the container.
//