Add config package with build-tag-switched dev/prod environments, structured logging via zerolog, Taskfile for dev workflow, golangci-lint config, testutil package, and improved DB setup with proper SQLite pragmas and cleanup. Rename sqlc output package from gen to repository. Switch to allowlist .gitignore, Alpine+UPX+scratch Dockerfile, and CI pipeline with test/lint gates before deploy.
19 lines
425 B
Docker
19 lines
425 B
Docker
FROM docker.io/golang:1.25.4-alpine AS build
|
|
|
|
RUN apk add --no-cache upx
|
|
|
|
WORKDIR /src
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
|
|
COPY . .
|
|
RUN go tool gotailwind -i assets/css/input.css -o assets/css/output.css --minify
|
|
RUN --mount=type=cache,target=/root/.cache/go-build \
|
|
CGO_ENABLED=0 go build -ldflags="-s" -o /bin/c4 .
|
|
RUN upx -9 -k /bin/c4
|
|
|
|
FROM scratch
|
|
ENV PORT=8080
|
|
COPY --from=build /bin/c4 /
|
|
ENTRYPOINT ["/c4"]
|