add:docker

This commit is contained in:
kokopi
2026-03-08 02:30:24 +09:00
parent 83fdf3134c
commit 33a92c239e
2 changed files with 49 additions and 0 deletions

42
Dockerfile Normal file
View File

@@ -0,0 +1,42 @@
# css build
FROM oven/bun:latest AS css
WORKDIR /app
RUN bun add tailwindcss @tailwindcss/cli
COPY tailwind.css ./tailwind.css
COPY templates/ ./templates/
RUN bunx @tailwindcss/cli \
-i ./tailwind.css \
-o ./static/css/app.css \
--minify
# go build
FROM golang:1.23-alpine AS builder
WORKDIR /app
RUN go install github.com/a-h/templ/cmd/templ@latest
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN templ generate
RUN go build -o server .
# final image
FROM alpine:latest
WORKDIR /app
COPY --from=builder /app/server .
COPY --from=css /app/static/css/app.css ./static/css/app.css
EXPOSE 3500
CMD ["./server"]