Skip to content

Commit ae8c0bf

Browse files
committed
Adds frontend build to Dockerfile
Adds Node.js and npm to the Docker image to allow building frontend assets during the Docker build process. This ensures that the Go embed functionality works correctly by including the necessary frontend files in the built binary.
1 parent 3ff4a67 commit ae8c0bf

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Dockerfile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
FROM golang:1.24-alpine AS builder
33

44
# Install build dependencies
5-
RUN apk add --no-cache git ca-certificates tzdata
5+
RUN apk add --no-cache git ca-certificates tzdata nodejs npm
66

77
# Set working directory
88
WORKDIR /app
@@ -13,6 +13,10 @@ COPY . .
1313
# Download dependencies (replace directive requires source to be present)
1414
RUN go mod download
1515

16+
# Build frontend assets required for Go embed
17+
RUN npm ci --prefix frontend
18+
RUN npm run build --prefix frontend
19+
1620
# Build the binary
1721
RUN CGO_ENABLED=0 GOOS=linux go build \
1822
-ldflags="-s -w" \

0 commit comments

Comments
 (0)