Skip to content

Commit

Permalink
multistage
Browse files Browse the repository at this point in the history
  • Loading branch information
mdmohsin7 committed Dec 15, 2024
1 parent 8ab3c4b commit 0827036
Showing 1 changed file with 21 additions and 5 deletions.
26 changes: 21 additions & 5 deletions personas-open-source/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Use Node.js LTS version
FROM node:18-alpine
FROM node:18-alpine AS base

# Set working directory
# Install dependencies only when needed
FROM base AS deps
WORKDIR /app

# Copy package files
Expand All @@ -10,9 +10,23 @@ COPY package*.json ./
# Install dependencies and types
RUN npm install --legacy-peer-deps && \
npm install --save-dev @types/mixpanel-browser --legacy-peer-deps
# && \
# npm install --save-dev @types/mixpanel-browser --legacy-peer-deps

# Rebuild the source code only when needed
FROM base AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
#COPY frontend/. .
COPY frontend .
ENV API_URL=https://backend-hhibjajaja-uc.a.run.app
RUN npm run build

RUN echo "base files"
RUN ls -la


# Production image, copy all the files and run next
FROM base AS runner
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules

# Copy all files
Expand Down Expand Up @@ -55,3 +69,5 @@ EXPOSE 3000

# Start the application
CMD ["npm", "start"]


0 comments on commit 0827036

Please sign in to comment.