35 lines
926 B
Docker
35 lines
926 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
|
|
|
|
WORKDIR /repo/backend
|
|
RUN npm install
|
|
|
|
WORKDIR /repo/frontend
|
|
RUN npm install
|
|
|
|
WORKDIR /repo
|
|
|
|
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/node_modules ./backend/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"]
|