@@ -45,6 +45,7 @@ func TestBunGenerateDockerfile(t *testing.T) {
45
45
tests := []struct {
46
46
name string
47
47
path string
48
+ data map [string ]string
48
49
expected []any
49
50
}{
50
51
{
@@ -57,6 +58,20 @@ func TestBunGenerateDockerfile(t *testing.T) {
57
58
path : "../testdata/bun-bunfig" ,
58
59
expected : []any {`ARG VERSION=1.1.4` , `ARG INSTALL_CMD="bun install"` , `ARG BUILD_CMD="bun run build:prod"` , `ARG START_CMD="bun run start:production"` },
59
60
},
61
+ {
62
+ name : "Bun project with build mounts" ,
63
+ path : "../testdata/bun-bunfig" ,
64
+ data : map [string ]string {"BuildMounts" : `--mount=type=secret,id=_env,target=/app/.env \
65
+ ` },
66
+ expected : []any {regexp .MustCompile (`^RUN --mount=type=secret,id=_env,target=/app/.env \\$` )},
67
+ },
68
+ {
69
+ name : "Bun project with install mounts" ,
70
+ path : "../testdata/bun-bunfig" ,
71
+ data : map [string ]string {"InstallMounts" : `--mount=type=secret,id=_env,target=/app/.env \
72
+ ` },
73
+ expected : []any {regexp .MustCompile (`^RUN --mount=type=secret,id=_env,target=/app/.env \\$` )},
74
+ },
60
75
{
61
76
name : "Not a Bun project" ,
62
77
path : "../testdata/deno" ,
@@ -67,7 +82,7 @@ func TestBunGenerateDockerfile(t *testing.T) {
67
82
for _ , test := range tests {
68
83
t .Run (test .name , func (t * testing.T ) {
69
84
bun := & runtime.Bun {Log : logger }
70
- dockerfile , err := bun .GenerateDockerfile (test .path )
85
+ dockerfile , err := bun .GenerateDockerfile (test .path , test . data )
71
86
if err != nil {
72
87
t .Errorf ("unexpected error: %v" , err )
73
88
}
0 commit comments