Skip to content

Commit ab37004

Browse files
fix
1 parent d270606 commit ab37004

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/backend/utils/container.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ export default function dockerize(
1010
if (!last_cmd) {
1111
throw new Error("build_cmds must contain at least one valid execution command");
1212
}
13-
const execute_cmd = "CMD " + JSON.stringify(last_cmd.split(" "));
14-
const build_steps = run_cmd.filter(Boolean).map((cmd) => `RUN ${cmd}`);
13+
let execute_cmd = "CMD " + JSON.stringify(last_cmd.split(" "));
14+
let build_steps = run_cmd.filter(Boolean).map((cmd) => `RUN ${cmd}`);
1515
if (stack == "Python") {
1616
dockerfile = [
1717
"FROM python:3.12-slim AS builder",
@@ -56,7 +56,7 @@ export default function dockerize(
5656
"WORKDIR /app",
5757
"COPY . .",
5858
"RUN if [ -f go.mod ]; then go mod download; fi",
59-
...build_steps,
59+
...build_steps.map(step => step.replace(/RUN go run (.+)/, "RUN go build -o app_binary $1")),
6060
"RUN find . -type f ! -executable -delete && rm -rf vendor/ .git/ *.go go.*",
6161
"",
6262
"FROM alpine:3.19",
@@ -66,7 +66,7 @@ export default function dockerize(
6666
"COPY --from=builder /app /app",
6767
"USER appuser",
6868
`EXPOSE ${port}`,
69-
execute_cmd,
69+
last_cmd.startsWith("go run") ? 'CMD ["./app_binary"]' : execute_cmd,
7070
].join("\n");
7171
}
7272
return dockerfile.toString();

0 commit comments

Comments
 (0)