Files
homeAutomation/energy-management/Dockerfile
Willem Serruys 22af3312ba fix dockerfile
2026-08-19 18:51:54 +02:00

28 lines
781 B
Docker

FROM node:22-slim AS build
RUN apt-get update && apt-get install -y --no-install-recommends python3 make g++ \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /repo
COPY package.json ./
COPY backend/package.json backend/package.json
COPY frontend/package.json frontend/package.json
RUN npm install
COPY backend backend
COPY frontend frontend
RUN npm run build
FROM node:22-slim AS runtime
WORKDIR /app
ENV NODE_ENV=production
COPY --from=build /repo/package.json ./package.json
COPY --from=build /repo/backend/package.json ./backend/package.json
COPY --from=build /repo/node_modules ./node_modules
COPY --from=build /repo/backend/dist ./backend/dist
COPY --from=build /repo/frontend/dist ./backend/dist/public
VOLUME ["/app/data"]
EXPOSE 3000
CMD ["node", "backend/dist/index.js"]