Skip to content

Commit d270606

Browse files
feat: Add GoLang support
1 parent e441064 commit d270606

2 files changed

Lines changed: 20 additions & 1 deletion

File tree

src/backend/utils/container.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,24 @@ export default function dockerize(
5050
`EXPOSE ${port}`,
5151
execute_cmd,
5252
].join("\n");
53+
} else if (stack === "Go") {
54+
dockerfile = [
55+
"FROM golang:1.22-alpine AS builder",
56+
"WORKDIR /app",
57+
"COPY . .",
58+
"RUN if [ -f go.mod ]; then go mod download; fi",
59+
...build_steps,
60+
"RUN find . -type f ! -executable -delete && rm -rf vendor/ .git/ *.go go.*",
61+
"",
62+
"FROM alpine:3.19",
63+
"RUN addgroup -S appgroup && adduser -S appuser -G appgroup",
64+
"RUN apk add --no-cache ca-certificates",
65+
"WORKDIR /app",
66+
"COPY --from=builder /app /app",
67+
"USER appuser",
68+
`EXPOSE ${port}`,
69+
execute_cmd,
70+
].join("\n");
5371
}
5472
return dockerfile.toString();
5573
}
@@ -63,6 +81,7 @@ export function dockerignore(stack: string): string {
6381
const stackRules: Record<string, string[]> = {
6482
Python: ["__pycache__/", "*.pyc", "*.pyo", ".venv/", "dist/", "*.egg-info/"],
6583
NodeJS: ["node_modules/", "dist/", ".npm/", "*.log", "coverage/"],
84+
Go: ["bin/", "obj/", "*.exe", "*.dll", "*.so", "*.dylib"],
6685
};
6786

6887
return [...common, ...(stackRules[stack] ?? [])].join("\n") + "\n";

src/frontend/src/components/modal.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export default {
6565
stack: '',
6666
build_cmds: '',
6767
resourceTypes: ['URL', 'PORT', 'GITHUB'],
68-
stacks: ['Python', 'NodeJS']
68+
stacks: ['Python', 'NodeJS', 'Go']
6969
};
7070
},
7171
methods: {

0 commit comments

Comments
 (0)