diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..46584c4 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,7 @@ +node_modules +npm-debug.log +Dockerfile +.dockerignore +.git +.gitignore +.env diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..e3eb26b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,23 @@ +FROM node:22-alpine AS build + +WORKDIR /app + +# Copie des dépendances +COPY package*.json ./ +RUN npm ci --only=production + +# Copie du code source +COPY . . + +# Étape 2 : image finale +FROM node:22-alpine + +WORKDIR /app + +# Copie uniquement les fichiers nécessaires +COPY --from=build /app ./ + +EXPOSE 3000 + +# Commande de démarrage +CMD ["node", "src/index.js"] diff --git a/README.md b/README.md new file mode 100644 index 0000000..67405d4 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +docker build -t mon-app . + +http://localhost:3000 diff --git a/compose.yml b/compose.yml new file mode 100644 index 0000000..df769f4 --- /dev/null +++ b/compose.yml @@ -0,0 +1,9 @@ +services: + app: + image: node:22-alpine + working_dir: /app + volumes: + - .:/app + ports: + - "3000:3000" + command: npm run dev