From dc87ec95389651498c6f91bb2e5dfdd5c0664b81 Mon Sep 17 00:00:00 2001 From: Emeline Nerot Date: Mon, 21 Apr 2025 09:06:27 +0000 Subject: [PATCH] Version Final! --- z2/.env | 1 - z2/Dockerfile | 15 ++++++--------- z2/deployment.yaml | 2 +- z2/service.yaml | 2 +- 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/z2/.env b/z2/.env index af9ceeb..9ede8d1 100644 --- a/z2/.env +++ b/z2/.env @@ -3,4 +3,3 @@ DB_PORT=5432 DB_USER=postgres DB_PASSWORD=motdepasse DB_NAME=tododb - diff --git a/z2/Dockerfile b/z2/Dockerfile index 791313b..2fac09d 100644 --- a/z2/Dockerfile +++ b/z2/Dockerfile @@ -1,24 +1,21 @@ -# Use the official Node.js 16 image as the base image -FROM node:16 - -# Install PostgreSQL client -RUN apt-get update && apt-get install -y postgresql-client +# Use a base Node.js image +FROM node:18 # Set the working directory WORKDIR /usr/src/app -# Copy the package.json and package-lock.json files +# Copy package.json and package-lock.json files COPY package*.json ./ # Install dependencies RUN npm install -# Copy the rest of the application code +# Copy the rest of the application files COPY . . # Expose the port the app runs on -EXPOSE 3000 +EXPOSE 3000 -# Command to run the application +# Command to start the application CMD ["node", "server.js"] diff --git a/z2/deployment.yaml b/z2/deployment.yaml index 5fa5412..7e17ced 100644 --- a/z2/deployment.yaml +++ b/z2/deployment.yaml @@ -20,7 +20,7 @@ spec: - containerPort: 3000 env: - name: DB_HOST - value: postgres-service + value: postgres-service.my-namespace.svc.cluster.local - name: DB_PORT value: "5432" - name: DB_USER diff --git a/z2/service.yaml b/z2/service.yaml index 003a524..0392621 100644 --- a/z2/service.yaml +++ b/z2/service.yaml @@ -11,4 +11,4 @@ spec: - protocol: TCP port: 80 targetPort: 3000 - nodePort: 30080 # Tu peux changer ce port si nécessaire (entre 30000–32767) + nodePort: 30080