diff --git a/personas-open-source/Dockerfile b/personas-open-source/Dockerfile index 5a17fcbcb..24feef0ff 100644 --- a/personas-open-source/Dockerfile +++ b/personas-open-source/Dockerfile @@ -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 @@ -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 @@ -55,3 +69,5 @@ EXPOSE 3000 # Start the application CMD ["npm", "start"] + +