feat: Set up CI/CD pipeline with embedded webapp and Woodpecker configuration

This commit is contained in:
garionion (aider) 2025-03-02 11:37:44 +01:00
parent ebbb2bac41
commit 6400eb9513
5 changed files with 163 additions and 3 deletions

32
Dockerfile Normal file
View file

@ -0,0 +1,32 @@
FROM golang:1.21-alpine as builder
WORKDIR /app
COPY . .
# Install build dependencies
RUN apk add --no-cache git build-base
# Build the frontend
RUN apk add --no-cache nodejs npm
RUN cd web && npm ci && npm run build
# Build the backend with embedded frontend
RUN go mod download
RUN go generate ./...
RUN go build -o inventory -ldflags="-s -w" .
# Create minimal runtime image
FROM alpine:latest
RUN apk --no-cache add ca-certificates tzdata
WORKDIR /app
COPY --from=builder /app/inventory .
COPY --from=builder /app/config.yaml ./config.yaml
# Create a non-root user to run the application
RUN adduser -D -H -h /app appuser
RUN chown -R appuser:appuser /app
USER appuser
EXPOSE 8088
CMD ["./inventory"]