Files
fast_reader/Dockerfile

47 lines
759 B
Docker

# Stage 1: Frontend build
FROM node:22-bookworm-slim AS frontend-builder
WORKDIR /frontend
COPY frontend/package.json ./
RUN npm install
COPY frontend/ ./
RUN npm run build
# Stage 2: Go build and test
FROM golang:1.24-bookworm AS go-builder
ENV CGO_ENABLED=1
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
pkg-config \
libgtk-3-dev \
libwebkit2gtk-4.1-dev \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download
COPY . .
COPY --from=frontend-builder /frontend/dist ./frontend/dist
RUN go test -v ./...
RUN go build -o /out/fast_reader .
# Stage 3: Export build artifact
FROM scratch AS artifact
COPY --from=go-builder /out/fast_reader /fast_reader