-
Notifications
You must be signed in to change notification settings - Fork 43
/
Copy pathconstants.go
57 lines (47 loc) · 1.78 KB
/
constants.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package constants
import (
"errors"
"fmt"
"path/filepath"
)
const (
// WorkspacesDir is the path to the directory where
// all workspaces are stored by default.
WorkspacesDir = "/workspaces"
// EmptyWorkspaceDir is the path to a workspace that has
// nothing going on... it's empty!
EmptyWorkspaceDir = WorkspacesDir + "/empty"
// MagicDir is where all envbuilder related files are stored.
// This is a special directory that must not be modified
// by the user or images.
MagicDir = "/.envbuilder"
)
var (
ErrNoFallbackImage = errors.New("no fallback image has been specified")
// MagicFile is a file that is created in the workspace
// when envbuilder has already been run. This is used
// to skip building when a container is restarting.
// e.g. docker stop -> docker start
MagicFile = filepath.Join(MagicDir, "built")
// MagicFile is the location of the build context when
// using remote build mode.
MagicRemoteRepoDir = filepath.Join(MagicDir, "repo")
// MagicBinaryLocation is the expected location of the envbuilder binary
// inside a builder image.
MagicBinaryLocation = filepath.Join(MagicDir, "bin", "envbuilder")
// MagicImage is a file that is created in the image when
// envbuilder has already been run. This is used to skip
// the destructive initial build step when 'resuming' envbuilder
// from a previously built image.
MagicImage = filepath.Join(MagicDir, "image")
// MagicDirectives are directives automatically appended to Dockerfiles
// when pushing the image. These directives allow the built image to be
// 're-used'.
MagicDirectives = fmt.Sprintf(`
COPY --chmod=0755 %[1]s %[2]s
COPY --chmod=0644 %[3]s %[4]s
USER root
WORKDIR /
ENTRYPOINT [%[2]q]
`, filepath.Base(MagicBinaryLocation), MagicBinaryLocation, filepath.Base(MagicImage), MagicImage)
)