# Build stage FROM node:22-alpine AS build ARG CACHEBUST=1 RUN echo "Cache bust: $CACHEBUST" # Build tools needed for argon2 native compilation RUN apk add --no-cache python3 make g++ WORKDIR /app # Install dependencies first (cache layer) COPY .env ./.env COPY package*.json ./ COPY client/package*.json ./client/ COPY server/package*.json ./server/ RUN cd client && npm install --legacy-peer-deps RUN cd server && npm install # Copy static assets COPY client/public/headshots ./client/public/headshots COPY client/public/logos ./client/public/logos COPY client/public/photos ./client/public/photos COPY client/public/sponsors ./client/public/sponsors COPY client/public/videos ./client/public/videos COPY client/public/minutes ./client/public/minutes COPY client/public/*.* ./client/public/ # Copy source COPY client/src ./client/src COPY client/*.js ./client/ COPY client/*.json ./client/ COPY server/src ./server/src COPY server/tsconfig.json ./server/ # Build client RUN cd client && npm run build # Build server RUN cd server && npm run build && npm prune --production # Production stage FROM node:22-alpine RUN apk add --no-cache python3 make g++ WORKDIR /app COPY --from=build /app/client/build ./client/build COPY --from=build /app/server/dist ./server/dist COPY --from=build /app/server/node_modules ./server/node_modules COPY --from=build /app/server/package.json ./server/package.json COPY --from=build /app/.env ./.env RUN mkdir -p uploads/headshots uploads/photos uploads/sponsors uploads/minutes WORKDIR /app/server EXPOSE 801 CMD ["node", "dist/index.js"]