แก้ไฟล์ build
This commit is contained in:
parent
87c856b372
commit
7e792b59a7
4 changed files with 126 additions and 25 deletions
43
Dockerfile
43
Dockerfile
|
|
@ -1,24 +1,35 @@
|
|||
FROM node:20-slim AS base
|
||||
|
||||
ENV PNPM_HOME="/pnpm"
|
||||
ENV PATH="$PNPM_HOME:$PATH"
|
||||
|
||||
RUN corepack enable
|
||||
FROM node:18-alpine as builder
|
||||
|
||||
# Create app directory
|
||||
WORKDIR /app
|
||||
|
||||
# Install app dependencies
|
||||
COPY package*.json ./
|
||||
|
||||
RUN npm ci
|
||||
|
||||
COPY . .
|
||||
|
||||
FROM base AS deps
|
||||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile
|
||||
RUN npm run build
|
||||
|
||||
FROM base AS build
|
||||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
|
||||
RUN pnpm run build
|
||||
FROM node:18-alpine
|
||||
|
||||
FROM base as prod
|
||||
COPY --from=deps /app/node_modules /app/node_modules
|
||||
COPY --from=build /app/dist /app/dist
|
||||
COPY --from=base /app/static /app/static
|
||||
ENV NODE_ENV production
|
||||
USER node
|
||||
|
||||
CMD ["node", "./dist/app.js"]
|
||||
# Create app directory
|
||||
WORKDIR /app
|
||||
|
||||
# Install app dependencies
|
||||
COPY package*.json ./
|
||||
# COPY .env ./
|
||||
|
||||
RUN npm ci --production
|
||||
|
||||
COPY --from=builder /app/dist ./dist
|
||||
|
||||
# COPY entrypoint.sh /usr/local/bin/entrypoint.sh
|
||||
# RUN chmod u+x /usr/local/bin/entrypoint.sh
|
||||
|
||||
# ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
||||
CMD [ "node", "dist/app.js" ]
|
||||
Loading…
Add table
Add a link
Reference in a new issue