From ca8c12ca6f018db2e3dce3ebbbc11ca187681077 Mon Sep 17 00:00:00 2001 From: Nicolas Drolet Date: Tue, 28 Oct 2025 14:45:06 -0400 Subject: [PATCH 1/3] feat(docker): add dockerfile for dockerization of backend in lab Should be in 10.100.251.2 --- Dockerfile | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..840a33b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,26 @@ +# Use the official Node.js image as the base image +FROM node:22 + +# Set the working directory inside the container +WORKDIR /usr/apptargo2/src/app + +# Copy package.json and package-lock.json to the working directory +COPY package*.json ./ + +# Install the application dependencies +RUN npm install + +# Copy the rest of the application files +COPY . . + +# Generate Prisma client +RUN npx prisma generate + +# Build the NestJS application +RUN npm run build + +# Expose the application port +EXPOSE 3000 + +# Command to run the application +CMD ["node", "dist/main"] From 2dd8bdb3c3b83a47582fd56c973c9dc2f1f77d8a Mon Sep 17 00:00:00 2001 From: Nicolas Drolet Date: Tue, 28 Oct 2025 15:34:20 -0400 Subject: [PATCH 2/3] fix(docker): Update workdir and CMD, add ENV variables for testing --- Dockerfile | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 840a33b..7063f1a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,27 @@ FROM node:22 # Set the working directory inside the container -WORKDIR /usr/apptargo2/src/app +WORKDIR /app + +# Set the environment variables +ENV DATABASE_URL_PROD="postgresql://apptargo:6wLAZrb0HZnd3mrmqXiArPcqLyui0o9e@10.100.0.116/app_targo_db?schema=public" +ENV DATABASE_URL_STAGING="postgresql://apptargo:6wLAZrb0HZnd3mrmqXiArPcqLyui0o9e@10.100.0.116/app_targo_db_staging?schema=public" +ENV DATABASE_URL_DEV="postgresql://apptargo:6wLAZrb0HZnd3mrmqXiArPcqLyui0o9e@10.100.0.116/app_targo_db_dev?schema=public" + +ENV AUTHENTIK_ISSUER="https://auth.targo.ca/application/o/montargo/" +ENV AUTHENTIK_CLIENT_ID="KUmSmvpu2aDDy4JfNwas7XriNFtPcj2Ka2PyLO5v" +ENV AUTHENTIK_CLIENT_SECRET="N55BgX1mxT7eiY99LOo5zXr5cKz9FgTsaCA9MdC7D8ZuhOGqozvqtNXVGbpY1eCg2kkYwJeJLP89sQ8R4cYybIJI7EwKijb19bzZQpUPwBosWwG3irUwdTnZOyw8yW5i" +ENV AUTHENTIK_CALLBACK_URL="http://10.100.251.2:3420/auth/callback" +ENV AUTHENTIK_AUTH_URL="https://auth.targo.ca/application/o/authorize/" +ENV AUTHENTIK_TOKEN_URL="https://auth.targo.ca/application/o/token/" +ENV AUTHENTIK_USERINFO_URL="https://auth.targo.ca/application/o/userinfo/" + +ENV TARGO_FRONTEND_URI="http://localhost:9000/" + +ENV ATTACHMENTS_SERVER_ID="server" +ENV ATTACHMENTS_ROOT=C:/ +ENV MAX_UPLOAD_MB=25 +ENV ALLOWED_MIME=image/jpeg,image/png,image/webp,application/pdf # Copy package.json and package-lock.json to the working directory COPY package*.json ./ @@ -23,4 +43,4 @@ RUN npm run build EXPOSE 3000 # Command to run the application -CMD ["node", "dist/main"] +CMD ["node", "dist/src/main"] From c0eef4e3a3595d1a2ee24ca0419375ae1d1ad6ca Mon Sep 17 00:00:00 2001 From: Nicolas Drolet Date: Wed, 29 Oct 2025 15:20:20 -0400 Subject: [PATCH 3/3] feat(docker): Add/Update Dockerfile for Remote Docker Lab deployment --- Dockerfile | 4 +++- src/main.ts | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7063f1a..21299ad 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,7 +17,9 @@ ENV AUTHENTIK_AUTH_URL="https://auth.targo.ca/application/o/authorize/" ENV AUTHENTIK_TOKEN_URL="https://auth.targo.ca/application/o/token/" ENV AUTHENTIK_USERINFO_URL="https://auth.targo.ca/application/o/userinfo/" -ENV TARGO_FRONTEND_URI="http://localhost:9000/" +ENV TARGO_FRONTEND_URI_1="http://targo-frontend-nicolas:9000" +ENV TARGO_FRONTEND_URI_2="http://targo-frontend-matthieu:9000" +ENV TARGO_FRONTEND_URI_3="http://targo-frontend-lion:9000" ENV ATTACHMENTS_SERVER_ID="server" ENV ATTACHMENTS_ROOT=C:/ diff --git a/src/main.ts b/src/main.ts index 88237b6..89eb564 100644 --- a/src/main.ts +++ b/src/main.ts @@ -46,7 +46,7 @@ async function bootstrap() { // Enable CORS app.enableCors({ - origin: 'http://localhost:9000', + origin: [process.env.TARGO_FRONTEND_URI_1, process.env.TARGO_FRONTEND_URI_2, process.env.TARGO_FRONTEND_URI_3], credentials: true, });