From 33a92c239e1ba5eaf439df4e9b2ad35971d6b93f Mon Sep 17 00:00:00 2001 From: kokopi Date: Sun, 8 Mar 2026 02:30:24 +0900 Subject: [PATCH] add:docker --- Dockerfile | 42 ++++++++++++++++++++++++++++++++++++++++++ docker-compose.yml | 7 +++++++ 2 files changed, 49 insertions(+) create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..5eb3169 --- /dev/null +++ b/Dockerfile @@ -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"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..30819aa --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,7 @@ +services: + personal-site: + build: . + container_name: personal-site + ports: + - "127.0.0.1:3500:3500" + restart: unless-stopped