rearrange: add dockerfile
This commit is contained in:
parent
e58b5c70c3
commit
93d41e8ded
|
|
@ -0,0 +1,30 @@
|
||||||
|
### Builder stage: install deps and generate Prisma clients
|
||||||
|
FROM node:20-alpine AS builder
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY package*.json package-lock.json ./
|
||||||
|
COPY prisma ./prisma
|
||||||
|
|
||||||
|
RUN npm ci
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
### Production stage: smaller runtime image
|
||||||
|
FROM node:20-alpine AS runner
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
RUN addgroup -S app && adduser -S app -G app
|
||||||
|
|
||||||
|
COPY --from=builder /app/app ./app
|
||||||
|
COPY --from=builder /app/prisma ./prisma
|
||||||
|
COPY --from=builder /app/index.js ./index.js
|
||||||
|
COPY --from=builder /app/node_modules ./node_modules
|
||||||
|
COPY --from=builder /app/package*.json ./
|
||||||
|
|
||||||
|
RUN chown -R app:app /app/prisma
|
||||||
|
|
||||||
|
USER app
|
||||||
|
|
||||||
|
EXPOSE 3000
|
||||||
|
|
||||||
|
CMD ["node", "index.js"]
|
||||||
Loading…
Reference in New Issue