From 532a68bc17c18b4ce43191f1c7e1df1cd66bab6e Mon Sep 17 00:00:00 2001 From: Yuanlin Lin Date: Wed, 29 Nov 2023 13:39:37 +0800 Subject: [PATCH] fix: Fix tests --- internal/nodejs/node_test.go | 4 ++++ internal/nodejs/templates/template.Dockerfile | 12 +----------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/internal/nodejs/node_test.go b/internal/nodejs/node_test.go index 91e9d7aa..890fff19 100644 --- a/internal/nodejs/node_test.go +++ b/internal/nodejs/node_test.go @@ -39,6 +39,8 @@ func TestGetContextBasedOnMeta_WithOutputdirAndSPAFramework(t *testing.T) { InstallCmd: "RUN npm install", BuildCmd: "npm run build", StartCmd: "npm run start", + Framework: "wtfisthis", + OutputDir: "dist", }) } @@ -57,5 +59,7 @@ func TestGetContextBasedOnMeta_WithOutputdirAndMPAFramework(t *testing.T) { InstallCmd: "RUN npm install", BuildCmd: "npm run build", StartCmd: "npm run start", + Framework: "hexo", + OutputDir: "dist", }) } diff --git a/internal/nodejs/templates/template.Dockerfile b/internal/nodejs/templates/template.Dockerfile index 479c30d2..bbe1176d 100644 --- a/internal/nodejs/templates/template.Dockerfile +++ b/internal/nodejs/templates/template.Dockerfile @@ -19,27 +19,17 @@ RUN corepack enable && corepack prepare --all {{ .InstallCmd }} COPY . . - {{ if and (eq .Framework "nuxt.js") .Serverless }} ENV NITRO_PRESET=node {{ end }} - # Build if we can build it {{ if .BuildCmd }}RUN {{ .BuildCmd }}{{ end }} - {{ if .Serverless }} - FROM scratch as output COPY --from=build /src / - {{ else if ne .OutputDir "" }} - FROM scratch as output COPY --from=build /src/{{ .OutputDir }} / - {{ else }} - EXPOSE 8080 -CMD {{ .StartCmd }} - -{{ end }} +CMD {{ .StartCmd }}{{ end }}