From fb363428ed0e4bcbe7aee83f70a34981f4f092c0 Mon Sep 17 00:00:00 2001 From: Dan Duvall Date: Tue, 9 May 2017 09:54:09 -0700 Subject: 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. --- build/instructions.go | 13 +++++++++++++ build/phases.go | 14 ++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 build/instructions.go create mode 100644 build/phases.go (limited to 'build') 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 +} -- cgit v1.2.1