From 7be853079dbb5524c104a2b16fd5d52acfccdb5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Mielcarek?= Date: Thu, 16 May 2024 17:03:17 +0200 Subject: [PATCH] Adding script CI --- .drone.yml | 31 +++++++++++++++++++++++++++++++ script/Dockerfile | 23 +++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 script/Dockerfile diff --git a/.drone.yml b/.drone.yml index 2d335cd..dea0575 100644 --- a/.drone.yml +++ b/.drone.yml @@ -64,3 +64,34 @@ steps: CLIENT_SECRET: from_secret: spotify_client_id depends_on: [ build-image-server ] + + - name: build-image-script + image: plugins/docker + settings: + dockerfile: script/Dockerfile + context: ./ + registry: hub.codefirst.iut.uca.fr + repo: hub.codefirst.iut.uca.fr/felix.mielcarek/big-brother + username: + from_secret: SECRET_REGISTRY_USERNAME + password: + from_secret: SECRET_REGISTRY_PASSWORD + + - name: deploy-container-script + image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-dockerproxy-clientdrone:latest + environment: + IMAGENAME: hub.codefirst.iut.uca.fr/felix.mielcarek/big-brother:latest + CONTAINERNAME: bigbrotherscript + COMMAND: create + OVERWRITE: true + POSTGRES_USER: + from_secret: db_user + POSTGRES_PASSWORD: + from_secret: db_password + POSTGRES_DATABASE: + from_secret: db_database + CLIENT_ID: + from_secret: spotify_client_id + CLIENT_SECRET: + from_secret: spotify_client_id + depends_on: [ build-image-script ] diff --git a/script/Dockerfile b/script/Dockerfile new file mode 100644 index 0000000..13997e3 --- /dev/null +++ b/script/Dockerfile @@ -0,0 +1,23 @@ +FROM node:latest + +# Install Python and pip +RUN apt-get update && \ + apt-get install -y python3 python3-pip && \ + rm -rf /var/lib/apt/lists/* + +# Set working directory inside the container +WORKDIR /usr/src/app + +COPY script/package*.json ./script/ +RUN npm install ./script + +COPY script ./script/ +COPY common ./common/ +RUN touch common/.env + +# Expose the port the app runs on +EXPOSE 80 + +# Command to run the application +CMD ["python3", "common/set-env-var.py"] +CMD ["node", "--env-file=common/.env" , "script/app.js"]