summaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
authorDan Duvall <dduvall@wikimedia.org>2017-05-09 09:54:09 -0700
committerDan Duvall <dduvall@wikimedia.org>2017-05-10 20:41:09 -0700
commitfb363428ed0e4bcbe7aee83f70a34981f4f092c0 (patch)
tree869706acf2182cd41c5d7bf4b4f98b1635086362 /build
parentd0ada7682fa323c52940c99113a8809aecfae06b (diff)
downloadblubber-fb363428ed0e4bcbe7aee83f70a34981f4f092c0.tar.gz
Decouple Docker compiler from apt/npm providers
Establish phases within Docker compiler to allow providers (apt, npm, etc.) to inject their own run/copy instructions into to the Dockerfile compilation process while leaving the compiler agnostic to the providers themselves. The instructions and phases are also generalized to leave room for alternative compilers should they be needed in the future (e.g. aci support via acbuild) but also as a general design constraint to leave compiler implementation concerns out of providers.
Diffstat (limited to 'build')
-rw-r--r--build/instructions.go13
-rw-r--r--build/phases.go14
2 files changed, 27 insertions, 0 deletions
diff --git a/build/instructions.go b/build/instructions.go
new file mode 100644
index 0000000..2676a75
--- /dev/null
+++ b/build/instructions.go
@@ -0,0 +1,13 @@
+package build
+
+type InstructionType int
+
+const (
+ Run InstructionType = iota
+ Copy
+)
+
+type Instruction struct {
+ Type InstructionType
+ Arguments []string
+}
diff --git a/build/phases.go b/build/phases.go
new file mode 100644
index 0000000..095263c
--- /dev/null
+++ b/build/phases.go
@@ -0,0 +1,14 @@
+package build
+
+type Phase int
+
+const (
+ PhasePrivileged Phase = iota
+ PhasePrivilegeDropped
+ PhasePreInstall
+ PhasePostInstall
+)
+
+type PhaseCompileable interface {
+ InstructionsForPhase(phase Phase) []Instruction
+}