fix: Dockerfile install devDeps for vite build + build tools for argon2
This commit is contained in:
15
Dockerfile
15
Dockerfile
@@ -1,19 +1,22 @@
|
|||||||
FROM node:20-alpine AS build
|
# Stage 1: Build frontend
|
||||||
|
FROM node:20-alpine AS build-client
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY package.json package-lock.json* ./
|
COPY package.json package-lock.json* ./
|
||||||
COPY packages/client/package.json packages/client/
|
COPY packages/client/package.json packages/client/
|
||||||
COPY packages/server/package.json packages/server/
|
COPY packages/server/package.json packages/server/
|
||||||
RUN npm install
|
RUN npm install --include=dev
|
||||||
COPY packages/client packages/client
|
COPY packages/client packages/client
|
||||||
RUN npm run build
|
RUN npm run build -w packages/client
|
||||||
|
|
||||||
|
# Stage 2: Production
|
||||||
FROM node:20-alpine
|
FROM node:20-alpine
|
||||||
|
RUN apk add --no-cache python3 make g++
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY package.json package-lock.json* ./
|
COPY package.json package-lock.json* ./
|
||||||
COPY packages/server/package.json packages/server/
|
COPY packages/server/package.json packages/server/
|
||||||
RUN npm install -w packages/server --omit=dev
|
RUN npm install -w packages/server --omit=dev && apk del python3 make g++
|
||||||
COPY --from=build /app/dist ./dist
|
COPY --from=build-client /app/dist ./dist
|
||||||
COPY packages/server packages/server
|
COPY packages/server packages/server
|
||||||
ENV NODE_ENV=production
|
ENV NODE_ENV=production PORT=80
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
CMD ["node", "packages/server/src/index.js"]
|
CMD ["node", "packages/server/src/index.js"]
|
||||||
|
|||||||
Reference in New Issue
Block a user