# Build React frontend # Stage 1: Install dependencies FROM node:14 AS fe-builder WORKDIR /app # Copy package.json and package-lock.json first to leverage caching COPY boxes-fe/package*.json ./ # Install dependencies RUN npm install # Copy the rest of your application code COPY boxes-fe/.env . COPY boxes-fe/. . # Build the application RUN npm run build # next stage FROM golang:latest WORKDIR /app COPY boxes-api/go.mod ./ COPY boxes-api/go.sum ./ RUN --mount=type=cache,target="./.cache/go-mod" go mod download COPY boxes-api/. ./ ENV CGO_ENABLED=1 #ENV GOCACHE=./.cache/go-build #RUN --mount=type=cache,target="./.cache/go-build" go build -o boxes-api . RUN go build -o boxes-api . COPY --from=fe-builder /app/build /app/build EXPOSE 8080 CMD ["/app/boxes-api"]