try go server
Some checks failed
Create and publish a Docker image 🚀 / build-and-push-image (push) Has been cancelled

This commit is contained in:
Smile Rex
2026-01-26 17:34:52 +03:00
parent fe2927be2e
commit 179961f5c0
2 changed files with 29 additions and 5 deletions

View File

@@ -5,9 +5,18 @@ RUN bun install
COPY . .
RUN bun run build
FROM oven/bun:slim
FROM golang:alpine AS server_builder
WORKDIR /app
COPY --from=build /app/build ./build
COPY server.ts ./server.ts
EXPOSE 3000
CMD ["bun", "server.ts"]
COPY go.mod ./
RUN go mod download
COPY main.go ./
COPY --from=frontend_builder /app/build ./build
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o main
FROM alpine:latest
WORKDIR /app
RUN apk add --no-cache ca-certificates
COPY --from=server_builder /app/main ./main
COPY --from=server_builder /app/build ./build
EXPOSE 8181
CMD ["./main"]

15
main.go Normal file
View File

@@ -0,0 +1,15 @@
package main
import (
"log"
"net/http"
)
func main() {
fs := http.FileServer(http.Dir("./dist"))
http.Handle("/", fs)
addr := ":8181"
log.Println("Server started on", addr)
log.Fatal(http.ListenAndServe(addr, nil))
}