mirror of
https://github.com/stonith404/pingvin-share.git
synced 2025-01-29 01:28:59 -05:00
performance: reduce docker image size
This commit is contained in:
parent
b8172efd59
commit
d6a88f2a22
1 changed files with 7 additions and 5 deletions
12
Dockerfile
12
Dockerfile
|
@ -1,11 +1,12 @@
|
|||
FROM node:18-alpine AS frontend-builder
|
||||
FROM node:18-slim AS frontend-builder
|
||||
WORKDIR /opt/app
|
||||
COPY frontend/package.json frontend/package-lock.json ./
|
||||
RUN npm ci
|
||||
COPY ./frontend .
|
||||
RUN npm run build
|
||||
|
||||
FROM node:18 AS backend-builder
|
||||
FROM node:18-slim AS backend-builder
|
||||
RUN apt-get update && apt-get install -y openssl
|
||||
WORKDIR /opt/app
|
||||
COPY backend/package.json backend/package-lock.json ./
|
||||
RUN npm ci
|
||||
|
@ -13,9 +14,10 @@ COPY ./backend .
|
|||
RUN npx prisma generate
|
||||
RUN npm run build
|
||||
|
||||
FROM node:18 AS runner
|
||||
WORKDIR /opt/app/frontend
|
||||
FROM node:18-slim AS runner
|
||||
ENV NODE_ENV=production
|
||||
RUN apt-get update && apt-get install -y openssl
|
||||
WORKDIR /opt/app/frontend
|
||||
COPY --from=frontend-builder /opt/app/next.config.js .
|
||||
COPY --from=frontend-builder /opt/app/public ./public
|
||||
COPY --from=frontend-builder /opt/app/.next ./.next
|
||||
|
@ -26,7 +28,7 @@ COPY --from=backend-builder /opt/app/node_modules ./node_modules
|
|||
COPY --from=backend-builder /opt/app/dist ./dist
|
||||
COPY --from=backend-builder /opt/app/prisma ./prisma
|
||||
COPY --from=backend-builder /opt/app/package.json ./
|
||||
WORKDIR /opt/app
|
||||
|
||||
WORKDIR /opt/app
|
||||
EXPOSE 3000
|
||||
CMD cd frontend && node_modules/.bin/next start & cd backend && npm run prod
|
Loading…
Add table
Reference in a new issue