♻️ Build on PocketBase defaults in container and tasks

This commit is contained in:
2026-11-30 17:39:27 +00:00
parent bb5ba06110
commit 74ebd2b38f
4 changed files with 32 additions and 19 deletions
+13
View File
@@ -0,0 +1,13 @@
.git
.github
web/node_modules
web/build
web/.svelte-kit
web/dev-dist
pb_data
wotra
wotra.db
wotra.db.*
wotra.tar.gz
*.md
!README.md
+2
View File
@@ -4,3 +4,5 @@ web/build/*
!web/build/.gitkeep !web/build/.gitkeep
web/.svelte-kit/ web/.svelte-kit/
web/node_modules/ web/node_modules/
pb_data/
wotra.db.*
+6 -7
View File
@@ -17,22 +17,21 @@ RUN go mod download
COPY . . COPY . .
COPY --from=web-builder /app/web/build ./web/build COPY --from=web-builder /app/web/build ./web/build
RUN go build -tags production -o wotra ./cmd/wotra RUN CGO_ENABLED=0 go build -trimpath -o /out/wotra .
# ── Stage 3: minimal runtime image ─────────────────────────────────────────── # ── Stage 3: minimal runtime image ───────────────────────────────────────────
FROM alpine:3.21 FROM alpine:3.21
RUN adduser -D -u 1000 wotra RUN apk add --no-cache ca-certificates && adduser -D -u 1000 wotra
WORKDIR /data WORKDIR /pb_data
USER wotra USER wotra
COPY --from=go-builder /app/wotra /usr/local/bin/wotra COPY --from=go-builder /out/wotra /usr/local/bin/wotra
EXPOSE 8080 EXPOSE 8080
ENV PORT=8080 \ VOLUME /pb_data
DB_PATH=/data/wotra.db \
TZ=UTC
ENTRYPOINT ["/usr/local/bin/wotra"] ENTRYPOINT ["/usr/local/bin/wotra"]
CMD ["serve", "--http=0.0.0.0:8080", "--dir=/pb_data"]
+11 -12
View File
@@ -12,12 +12,6 @@ auto = true
go = "1.27.0" go = "1.27.0"
node = "24.14.0" node = "24.14.0"
[env]
AUTH_TOKEN = "devtoken"
PORT = "8080"
DB_PATH = "wotra.db"
TZ = "UTC"
[tasks.build] [tasks.build]
description = "Build production single binary (web + Go, sequential)" description = "Build production single binary (web + Go, sequential)"
run = """ run = """
@@ -32,20 +26,20 @@ run = "npm run build"
[tasks."build:go"] [tasks."build:go"]
description = "Build Go binary with embedded web assets" description = "Build Go binary with embedded web assets"
run = "go build -tags production -o wotra ./cmd/wotra" run = "go build -trimpath -o wotra ."
[tasks.dev] [tasks.dev]
description = "Start Go API and Vite dev server concurrently" description = "Start PocketBase API and Vite dev server concurrently"
run = """ run = """
echo "Go API: http://localhost:${PORT}" echo "PocketBase API: http://localhost:8080 (admin UI: /_/)"
echo "Vite UI: http://localhost:5173" echo "Vite UI: http://localhost:5173"
mise run dev:api & mise run dev:ui mise run dev:api & mise run dev:ui
wait wait
""" """
[tasks."dev:api"] [tasks."dev:api"]
description = "Start Go API server" description = "Start PocketBase API server"
run = "go run ./cmd/wotra" run = "go run . serve --http=127.0.0.1:8080"
[tasks."dev:ui"] [tasks."dev:ui"]
description = "Start Vite dev server" description = "Start Vite dev server"
@@ -65,9 +59,14 @@ run = "npm test"
description = "Run Go tests and frontend Vitest tests" description = "Run Go tests and frontend Vitest tests"
depends = ["test", "test:web"] depends = ["test", "test:web"]
[tasks.check]
description = "Lint and typecheck"
run = ["go vet ./...", "test -z \"$(gofmt -l .)\"", "npm --prefix web run check"]
[tasks.clean] [tasks.clean]
description = "Remove build artifacts" description = "Remove build artifacts"
run = """ run = """
rm -f wotra rm -f wotra
rm -rf web/build web/.svelte-kit rm -rf web/build web/.svelte-kit web/dev-dist
mkdir -p web/build && touch web/build/.gitkeep
""" """