FROM node:20 AS frontend

WORKDIR /buildfront
COPY frontend/wizard-vue/package.json frontend/wizard-vue/package-lock.json ./
RUN npm install
COPY frontend/wizard-vue ./
RUN npm run build

FROM golang:1.23

WORKDIR /app

COPY go.mod go.sum ./
RUN go mod download

COPY . .
COPY --from=frontend /buildfront/dist ./frontend/wizard-vue/dist
RUN go build -o bin/webserver github.com/egor3f/rssalchemy/cmd/webserver

EXPOSE 8080
CMD ["/app/bin/webserver"]
