23 lines
748 B
Docker
23 lines
748 B
Docker
# Stage 1: Build frontend
|
|
FROM node:20-alpine AS build-client
|
|
WORKDIR /app
|
|
COPY package.json package-lock.json* ./
|
|
COPY packages/client/package.json packages/client/
|
|
COPY packages/server/package.json packages/server/
|
|
RUN npm install --include=dev
|
|
COPY packages/client packages/client
|
|
RUN npm run build -w packages/client
|
|
|
|
# Stage 2: Production
|
|
FROM node:20-alpine
|
|
RUN apk add --no-cache python3 make g++
|
|
WORKDIR /app
|
|
COPY package.json package-lock.json* ./
|
|
COPY packages/server/package.json packages/server/
|
|
RUN npm install -w packages/server --omit=dev && apk del python3 make g++
|
|
COPY --from=build-client /app/dist ./dist
|
|
COPY packages/server packages/server
|
|
ENV NODE_ENV=production PORT=80
|
|
EXPOSE 80
|
|
CMD ["node", "packages/server/src/index.js"]
|