mirror of
https://github.com/arthur-pbty/calculatrice.git
synced 2026-06-03 15:07:19 +02:00
Refactor Dockerfile, update README, and enhance Calculator component
- Refactored Dockerfile for improved multi-stage builds and added development and production configurations. - Updated README with clearer project description, local development instructions, and added contact information. - Enhanced Calculator component to manage theme and history using localStorage, improving user experience. - Added new pages for legal mentions and privacy policy, including relevant metadata. - Updated docker-compose.yml for better service management and added environment variables. - Introduced a new LICENSE file outlining usage rights and responsibilities.
This commit is contained in:
+16
-24
@@ -1,34 +1,26 @@
|
||||
# === Étape 1 : Build ===
|
||||
FROM node:20-alpine AS builder
|
||||
|
||||
FROM node:22-alpine AS calculatrice-base
|
||||
WORKDIR /app
|
||||
ENV NEXT_TELEMETRY_DISABLED=1
|
||||
|
||||
# Copier les fichiers de dépendances pour profiter du cache Docker
|
||||
COPY package*.json ./
|
||||
|
||||
# Installer uniquement ce qu'il faut pour le build
|
||||
FROM calculatrice-base AS calculatrice-deps
|
||||
COPY package.json package-lock.json ./
|
||||
RUN npm ci
|
||||
|
||||
# Copier tout le code
|
||||
FROM calculatrice-deps AS calculatrice-dev
|
||||
COPY . .
|
||||
EXPOSE 3000
|
||||
CMD ["npm", "run", "dev", "--", "--hostname", "0.0.0.0", "--port", "3000"]
|
||||
|
||||
# Build Next.js pour la production
|
||||
FROM calculatrice-deps AS calculatrice-builder
|
||||
COPY . .
|
||||
RUN npm run build
|
||||
|
||||
# === Étape 2 : Runner léger ===
|
||||
FROM node:20-alpine AS runner
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copier uniquement ce qui est nécessaire pour la prod
|
||||
COPY --from=builder /app/package*.json ./
|
||||
COPY --from=builder /app/node_modules ./node_modules
|
||||
COPY --from=builder /app/.next ./.next
|
||||
COPY --from=builder /app/public ./public
|
||||
|
||||
# Mode production
|
||||
FROM calculatrice-base AS calculatrice-runner
|
||||
ENV NODE_ENV=production
|
||||
ENV HOSTNAME=0.0.0.0
|
||||
ENV PORT=3000
|
||||
COPY --from=calculatrice-builder /app/.next/standalone ./
|
||||
COPY --from=calculatrice-builder /app/.next/static ./.next/static
|
||||
COPY --from=calculatrice-builder /app/public ./public
|
||||
EXPOSE 3000
|
||||
|
||||
# Lancer le serveur Next.js
|
||||
CMD ["npm", "start"]
|
||||
CMD ["node", "server.js"]
|
||||
Reference in New Issue
Block a user