From cb4bbc2ddebb304a7712f7b42b0ce108b04ec16d Mon Sep 17 00:00:00 2001 From: Alix JEUDI--LEMOINE Date: Thu, 29 May 2025 15:43:11 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=80=20=F0=9F=91=B7=20Add=20CI/CD=20pip?= =?UTF-8?q?eline?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .drone.yml | 45 +++++++++++++++++++++++++++++++++++++++++++++ docker/Dockerfile | 17 +++++++++++++++++ package.json | 3 ++- 3 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 .drone.yml create mode 100644 docker/Dockerfile diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..2b7cdc5 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,45 @@ +kind: pipeline +type: docker +name: Administration CI/CD + +trigger: + event: + - push + +steps: + - name: code-analysis + image: hub.codefirst.iut.uca.fr/alix.jeudi--lemoine/codefirst-dronesonarplugin-node:latest + commands: + - npm install + - /opt/sonar-scanner/bin/sonar-scanner + -Dsonar.login=$PLUGIN_SONAR_TOKEN + -Dsonar.projectKey=SAE3A_MemoryMap-admin + -Dsonar.sources=src + -Dsonar.exclusions=**/*.spec.ts,**/node_modules/** + settings: + sonar_token: + from_secret: SECRET_SONAR_TOKEN + + - name: docker-build-and-push + image: plugins/docker + settings: + dockerfile: docker/Dockerfile + context: . + registry: hub.codefirst.iut.uca.fr + mirror: https://proxy.iut.uca.fr:8443 + repo: hub.codefirst.iut.uca.fr/alix.jeudi--lemoine/memorymap_admin + username: + from_secret: SECRET_REGISTRY_USERNAME + password: + from_secret: SECRET_REGISTRY_PASSWORD + depends_on: [ code-analysis ] + + - name: deploy-admin + image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-dockerproxy-clientdrone:latest + environment: + IMAGENAME: hub.codefirst.iut.uca.fr/alix.jeudi--lemoine/memorymap_admin:latest + CONTAINERNAME: admin + COMMAND: create + OVERWRITE: true + ADMINS: alixjeudi--lemoine,alexisferon,mathisframit,maxencejouannet + depends_on: [ docker-build-and-push ] \ No newline at end of file diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..e12d352 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,17 @@ +# Official Node.js image +FROM node:22-slim + +# Set workdir +WORKDIR /app + +# Copy the Angular app folder in the container +COPY . . + +# Install dependencies +RUN npm install + +# Expose port +EXPOSE 80 + +# Start the application +CMD [ "npm", "run", "production" ] \ No newline at end of file diff --git a/package.json b/package.json index d01086b..2d17738 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,8 @@ "start": "ng serve", "build": "ng build", "watch": "ng build --watch --configuration development", - "test": "ng test" + "test": "ng test", + "production": "ng serve --host 0.0.0.0 --port 80 --configuration=production" }, "private": true, "dependencies": {