- Dockerfile: add COPY db/ /app/db/ so migrations are available at runtime (server/src/db.js requires ../../db/migrations at startup) - vite.config.js: fix dev proxy port from 3001 to 3000 to match server's default PORT Docker build passes; server starts and connects to DB correctly. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
31 lines
541 B
Docker
31 lines
541 B
Docker
# Stage 1: build the React client
|
|
FROM node:20-alpine AS client-build
|
|
|
|
WORKDIR /app/client
|
|
|
|
COPY client/package.json ./
|
|
RUN npm install
|
|
|
|
COPY client/ ./
|
|
RUN npm run build
|
|
|
|
# Stage 2: production server
|
|
FROM node:20-alpine AS production
|
|
|
|
WORKDIR /app/server
|
|
|
|
COPY server/package.json ./
|
|
RUN npm install --omit=dev
|
|
|
|
COPY server/ ./
|
|
|
|
# Copy db migrations (required by server/src/db.js at runtime)
|
|
COPY db/ /app/db/
|
|
|
|
# Copy built client assets
|
|
COPY --from=client-build /app/client/dist /app/client/dist
|
|
|
|
EXPOSE 3000
|
|
|
|
CMD ["node", "src/index.js"]
|