Migrated to NodeJS/Vite/Express/Material UI 2 #1
@@ -1,34 +1,50 @@
|
||||
# Build stage
|
||||
FROM node:24-trixie-slim AS build
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY backend/package*.json backend/
|
||||
COPY frontend/package*.json frontend/
|
||||
RUN cd backend && npm ci
|
||||
RUN cd frontend && npm ci
|
||||
# Copy sources required for build
|
||||
COPY backend/*.json backend/
|
||||
COPY backend/src backend/src
|
||||
|
||||
COPY . .
|
||||
COPY frontend/*.json frontend/
|
||||
COPY frontend/vite.config.ts frontend/vite.config.ts
|
||||
COPY frontend/index.html frontend/index.html
|
||||
COPY frontend/src frontend/src
|
||||
COPY frontend/test frontend/test
|
||||
|
||||
RUN cd backend && npm run build
|
||||
RUN cd frontend && npm run build
|
||||
RUN cd backend && npm prune --omit=dev
|
||||
COPY templates templates
|
||||
COPY templates.json templates.json
|
||||
|
||||
# Build backend and frontend
|
||||
RUN cd backend && npm ci && npm run build && npm prune --omit=dev
|
||||
RUN cd frontend && npm ci && npm run build
|
||||
|
||||
# Build the container
|
||||
FROM node:24-trixie-slim AS runtime
|
||||
|
||||
WORKDIR /app
|
||||
ENV NODE_ENV=production
|
||||
ENV PORT=3000
|
||||
|
||||
# Copy built artifacts
|
||||
COPY --from=build /app/dist dist
|
||||
COPY --from=build /app/templates templates
|
||||
COPY --from=build /app/templates.json templates.json
|
||||
COPY --from=build /app/backend/node_modules dist/backend/node_modules
|
||||
|
||||
WORKDIR /app
|
||||
# Copy entrypoint and healthcheck scripts
|
||||
COPY entrypoint.sh entrypoint.sh
|
||||
COPY healthcheck.js healthcheck.js
|
||||
|
||||
# Ensure entrypoint script is executable
|
||||
RUN chmod +x entrypoint.sh
|
||||
|
||||
# Set environment variables and expose port
|
||||
ENV NODE_ENV=production
|
||||
ENV PORT=3000
|
||||
EXPOSE 3000
|
||||
|
||||
# Configure health check
|
||||
HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=3 CMD ["node", "/app/healthcheck.js"]
|
||||
|
||||
# Configure entrypoint
|
||||
ENTRYPOINT ["./entrypoint.sh"]
|
||||
|
||||
Reference in New Issue
Block a user