diff --git a/Dockerfiles/Dockerfile.agent-provisioning b/Dockerfiles/Dockerfile.agent-provisioning index 17c820995..46a235233 100644 --- a/Dockerfiles/Dockerfile.agent-provisioning +++ b/Dockerfiles/Dockerfile.agent-provisioning @@ -2,30 +2,43 @@ FROM node:18-alpine as build RUN set -eux \ + # Install packages and dependencies && apk --no-cache add \ openssh-client \ aws-cli \ docker \ docker-compose \ + postgresql-client \ + # Install pnpm globally without running scripts && npm install -g pnpm --ignore-scripts \ + # Update PATH for pnpm && export PATH=$PATH:/usr/lib/node_modules/pnpm/bin \ + # Clean up && rm -rf /var/cache/apk/* +# Add PostgreSQL client to the image +RUN apk add --no-cache postgresql-client + # Set the working directory WORKDIR /app # Copy package.json and package-lock.json COPY package.json ./ -# Install dependencies -RUN pnpm i +# Install dependencies safely +RUN pnpm i --ignore-scripts \ + && pnpm add -D ts-node typescript @types/node --ignore-scripts # Copy the rest of the application code COPY . . +RUN chown -R node:node /app/libs/prisma-service/prisma/scripts/ +RUN chmod +x /app/libs/prisma-service/prisma/scripts/geo_location_data_import.sh +RUN chmod +x /app/libs/prisma-service/prisma/scripts/update_client_credential_data.sh + # Generate Prisma client # RUN cd libs/prisma-service && npx prisma migrate deploy && npx prisma generate -RUN cd libs/prisma-service && npx prisma migrate deploy && npx prisma generate +RUN cd libs/prisma-service && npx prisma migrate deploy && npx prisma generate && npx prisma db seed RUN ls -R /app/apps/agent-provisioning/AFJ/ # Build the user service @@ -70,4 +83,4 @@ RUN chmod 777 /app/agent-provisioning/AFJ/token COPY libs/ ./libs/ # Set the command to run the microservice -CMD ["sh", "-c", "cd libs/prisma-service && npx prisma migrate deploy && cd ../.. && node dist/apps/agent-provisioning/main.js"] \ No newline at end of file +CMD ["sh", "-c", "cd libs/prisma-service && npx prisma migrate deploy && npx prisma db seed && cd ../.. && node dist/apps/agent-provisioning/main.js"] \ No newline at end of file diff --git a/Dockerfiles/Dockerfile.agent-service b/Dockerfiles/Dockerfile.agent-service index 0a6d8d3f8..6f3a1f538 100644 --- a/Dockerfiles/Dockerfile.agent-service +++ b/Dockerfiles/Dockerfile.agent-service @@ -7,21 +7,32 @@ RUN npm install -g pnpm --ignore-scripts \ && apk add aws-cli \ && apk add docker \ && apk add docker-compose - + +# Add PostgreSQL client to the image +RUN apk add --no-cache postgresql-client + RUN npm install -g pnpm + # Set the working directory WORKDIR /app # Copy package.json and package-lock.json COPY package.json ./ -# Install dependencies -RUN pnpm i +# Install dependencies safely +RUN pnpm i --ignore-scripts \ + && pnpm add -D ts-node typescript @types/node --ignore-scripts + # Copy the rest of the application code COPY . . + +RUN chown -R node:node /app/libs/prisma-service/prisma/scripts/ +RUN chmod +x /app/libs/prisma-service/prisma/scripts/geo_location_data_import.sh +RUN chmod +x /app/libs/prisma-service/prisma/scripts/update_client_credential_data.sh + # RUN cd libs/prisma-service && npx prisma migrate deploy && npx prisma generate -RUN cd libs/prisma-service && npx prisma migrate deploy && npx prisma generate +RUN cd libs/prisma-service && npx prisma migrate deploy && npx prisma generate && npx prisma db seed # Build the user service RUN pnpm run build agent-service @@ -49,4 +60,4 @@ COPY --from=build /app/libs/ ./libs/ COPY --from=build /app/node_modules ./node_modules # Set the command to run the microservice -CMD ["sh", "-c", "cd libs/prisma-service && npx prisma migrate deploy && cd ../.. && node dist/apps/agent-service/main.js"] +CMD ["sh", "-c", "cd libs/prisma-service && npx prisma migrate deploy && npx prisma db seed && cd ../.. && node dist/apps/agent-service/main.js"] \ No newline at end of file diff --git a/Dockerfiles/Dockerfile.api-gateway b/Dockerfiles/Dockerfile.api-gateway index 460cb1751..12c10e428 100644 --- a/Dockerfiles/Dockerfile.api-gateway +++ b/Dockerfiles/Dockerfile.api-gateway @@ -1,6 +1,10 @@ # Stage 1: Build the application FROM node:18-alpine as build RUN npm install -g pnpm + +# Add PostgreSQL client to the image +RUN apk add --no-cache postgresql-client + # Set the working directory WORKDIR /app @@ -8,13 +12,19 @@ WORKDIR /app COPY package.json ./ # COPY package-lock.json ./ -# Install dependencies -RUN pnpm i +# Install dependencies safely +RUN pnpm i --ignore-scripts \ + && pnpm add -D ts-node typescript @types/node --ignore-scripts # Copy the rest of the application code COPY . . + +RUN chown -R node:node /app/libs/prisma-service/prisma/scripts/ +RUN chmod +x /app/libs/prisma-service/prisma/scripts/geo_location_data_import.sh +RUN chmod +x /app/libs/prisma-service/prisma/scripts/update_client_credential_data.sh + # RUN cd libs/prisma-service && npx prisma migrate deploy && npx prisma generate -RUN cd libs/prisma-service && npx prisma migrate deploy && npx prisma generate +RUN cd libs/prisma-service && npx prisma migrate deploy && npx prisma generate && npx prisma db seed # Build the api-gateway service RUN pnpm run build api-gateway @@ -34,4 +44,4 @@ COPY --from=build /app/node_modules ./node_modules # COPY --from=build /app/uploadedFiles ./uploadedFiles # Set the command to run the microservice -CMD ["sh", "-c", "cd libs/prisma-service && npx prisma migrate deploy && cd ../.. && node dist/apps/api-gateway/main.js"] +CMD ["sh", "-c", "cd libs/prisma-service && npx prisma migrate deploy && npx prisma db seed && cd ../.. && node dist/apps/api-gateway/main.js"] \ No newline at end of file diff --git a/Dockerfiles/Dockerfile.cloud-wallet b/Dockerfiles/Dockerfile.cloud-wallet index 1ddb48e3c..4487bf530 100644 --- a/Dockerfiles/Dockerfile.cloud-wallet +++ b/Dockerfiles/Dockerfile.cloud-wallet @@ -2,6 +2,9 @@ FROM node:18-slim as build RUN npm install -g pnpm +# Add PostgreSQL client to the image +RUN apk add --no-cache postgresql-client + RUN apt-get update -y RUN apt-get --no-install-recommends install -y openssl # Set the working directory @@ -10,13 +13,19 @@ WORKDIR /app # Copy package.json and package-lock.json COPY package.json ./ -# Install dependencies -RUN pnpm install +# Install dependencies safely +RUN pnpm i --ignore-scripts \ + && pnpm add -D ts-node typescript @types/node --ignore-scripts # Copy the rest of the application code COPY . . + +RUN chown -R node:node /app/libs/prisma-service/prisma/scripts/ +RUN chmod +x /app/libs/prisma-service/prisma/scripts/geo_location_data_import.sh +RUN chmod +x /app/libs/prisma-service/prisma/scripts/update_client_credential_data.sh + # RUN cd libs/prisma-service && npx prisma migrate deploy && npx prisma generate -RUN cd libs/prisma-service && npx prisma migrate deploy && npx prisma generate +RUN cd libs/prisma-service && npx prisma migrate deploy && npx prisma generate && npx prisma db seed # Build the user service RUN pnpm run build cloud-wallet @@ -40,4 +49,4 @@ COPY --from=build /app/node_modules ./node_modules # Set the command to run the microservice -CMD ["sh", "-c", "cd libs/prisma-service && npx prisma migrate deploy && cd ../.. && node dist/apps/cloud-wallet/main.js"] +CMD ["sh", "-c", "cd libs/prisma-service && npx prisma migrate deploy && npx prisma db seed && cd ../.. && node dist/apps/cloud-wallet/main.js"] \ No newline at end of file diff --git a/Dockerfiles/Dockerfile.connection b/Dockerfiles/Dockerfile.connection index bca3dd342..6f5f679f5 100644 --- a/Dockerfiles/Dockerfile.connection +++ b/Dockerfiles/Dockerfile.connection @@ -1,6 +1,10 @@ # Stage 1: Build the application FROM node:18-alpine as build RUN npm install -g pnpm + +# Add PostgreSQL client to the image +RUN apk add --no-cache postgresql-client + # Set the working directory WORKDIR /app @@ -8,13 +12,19 @@ WORKDIR /app COPY package.json ./ #COPY package-lock.json ./ -# Install dependencies -RUN pnpm i +# Install dependencies safely +RUN pnpm i --ignore-scripts \ + && pnpm add -D ts-node typescript @types/node --ignore-scripts # Copy the rest of the application code COPY . . + +RUN chown -R node:node /app/libs/prisma-service/prisma/scripts/ +RUN chmod +x /app/libs/prisma-service/prisma/scripts/geo_location_data_import.sh +RUN chmod +x /app/libs/prisma-service/prisma/scripts/update_client_credential_data.sh + # RUN cd libs/prisma-service && npx prisma migrate deploy && npx prisma generate -RUN cd libs/prisma-service && npx prisma migrate deploy && npx prisma generate +RUN cd libs/prisma-service && npx prisma migrate deploy && npx prisma generate && npx prisma db seed # Build the connection service RUN pnpm run build connection @@ -37,4 +47,4 @@ COPY --from=build /app/node_modules ./node_modules #RUN npm i --only=production # Set the command to run the microservice -CMD ["sh", "-c", "cd libs/prisma-service && npx prisma migrate deploy && cd ../.. && node dist/apps/connection/main.js"] +CMD ["sh", "-c", "cd libs/prisma-service && npx prisma migrate deploy && npx prisma db seed && cd ../.. && node dist/apps/connection/main.js"] \ No newline at end of file diff --git a/Dockerfiles/Dockerfile.ecosystem b/Dockerfiles/Dockerfile.ecosystem index 892b35d05..c1ed5209b 100644 --- a/Dockerfiles/Dockerfile.ecosystem +++ b/Dockerfiles/Dockerfile.ecosystem @@ -1,6 +1,10 @@ # Stage 1: Build the application FROM node:18-alpine as build RUN npm install -g pnpm + +# Add PostgreSQL client to the image +RUN apk add --no-cache postgresql-client + # Set the working directory WORKDIR /app @@ -8,13 +12,19 @@ WORKDIR /app COPY package.json ./ #COPY package-lock.json ./ -# Install dependencies -RUN pnpm i +# Install dependencies safely +RUN pnpm i --ignore-scripts \ + && pnpm add -D ts-node typescript @types/node --ignore-scripts # Copy the rest of the application code COPY . . + +RUN chown -R node:node /app/libs/prisma-service/prisma/scripts/ +RUN chmod +x /app/libs/prisma-service/prisma/scripts/geo_location_data_import.sh +RUN chmod +x /app/libs/prisma-service/prisma/scripts/update_client_credential_data.sh + # RUN cd libs/prisma-service && npx prisma migrate deploy && npx prisma generate -RUN cd libs/prisma-service && npx prisma migrate deploy && npx prisma generate +RUN cd libs/prisma-service && npx prisma migrate deploy && npx prisma generate && npx prisma db seed # Build the issuance service RUN pnpm run build ecosystem @@ -35,4 +45,4 @@ COPY --from=build /app/node_modules ./node_modules # Set the command to run the microservice -CMD ["sh", "-c", "cd libs/prisma-service && npx prisma migrate deploy && cd ../.. && node dist/apps/ecosystem/main.js"] +CMD ["sh", "-c", "cd libs/prisma-service && npx prisma migrate deploy && npx prisma db seed && cd ../.. && node dist/apps/ecosystem/main.js"] \ No newline at end of file diff --git a/Dockerfiles/Dockerfile.geolocation b/Dockerfiles/Dockerfile.geolocation index 3a297b3ce..7108e1e5d 100644 --- a/Dockerfiles/Dockerfile.geolocation +++ b/Dockerfiles/Dockerfile.geolocation @@ -1,6 +1,10 @@ # Stage 1: Build the application FROM node:18-alpine as build RUN npm install -g pnpm + +# Add PostgreSQL client to the image +RUN apk add --no-cache postgresql-client + # Set the working directory WORKDIR /app @@ -9,12 +13,20 @@ COPY package.json ./ #COPY package-lock.json ./ # Install dependencies -RUN pnpm i +# Install dependencies safely +RUN pnpm i --ignore-scripts \ + && pnpm add -D ts-node typescript @types/node --ignore-scripts + # Copy the rest of the application code COPY . . + +RUN chown -R node:node /app/libs/prisma-service/prisma/scripts/ +RUN chmod +x /app/libs/prisma-service/prisma/scripts/geo_location_data_import.sh +RUN chmod +x /app/libs/prisma-service/prisma/scripts/update_client_credential_data.sh + # RUN cd libs/prisma-service && npx prisma migrate deploy && npx prisma generate -RUN cd libs/prisma-service && npx prisma migrate deploy && npx prisma generate +RUN cd libs/prisma-service && npx prisma migrate deploy && npx prisma generate && npx prisma db seed # Build the connection service RUN pnpm run build geo-location @@ -37,4 +49,4 @@ COPY --from=build /app/node_modules ./node_modules #RUN npm i --only=production # Set the command to run the microservice -CMD ["sh", "-c", "cd libs/prisma-service && npx prisma migrate deploy && cd ../.. && node dist/apps/geo-location/main.js"] \ No newline at end of file +CMD ["sh", "-c", "cd libs/prisma-service && npx prisma migrate deploy && npx prisma db seed && cd ../.. && node dist/apps/geo-location/main.js"] \ No newline at end of file diff --git a/Dockerfiles/Dockerfile.issuance b/Dockerfiles/Dockerfile.issuance index cc90ba6f7..d64ed4203 100644 --- a/Dockerfiles/Dockerfile.issuance +++ b/Dockerfiles/Dockerfile.issuance @@ -1,6 +1,10 @@ # Stage 1: Build the application FROM node:18-alpine as build RUN npm install -g pnpm + +# Add PostgreSQL client to the image +RUN apk add --no-cache postgresql-client + # Set the working directory WORKDIR /app @@ -8,13 +12,20 @@ WORKDIR /app COPY package.json ./ #COPY package-lock.json ./ -# Install dependencies -RUN pnpm i +# Install dependencies safely +RUN pnpm i --ignore-scripts \ + && pnpm add -D ts-node typescript @types/node --ignore-scripts + # Copy the rest of the application code COPY . . + +RUN chown -R node:node /app/libs/prisma-service/prisma/scripts/ +RUN chmod +x /app/libs/prisma-service/prisma/scripts/geo_location_data_import.sh +RUN chmod +x /app/libs/prisma-service/prisma/scripts/update_client_credential_data.sh + # RUN cd libs/prisma-service && npx prisma migrate deploy && npx prisma generate -RUN cd libs/prisma-service && npx prisma migrate deploy && npx prisma generate +RUN cd libs/prisma-service && npx prisma migrate deploy && npx prisma generate && npx prisma db seed # Build the issuance service RUN pnpm run build issuance @@ -36,4 +47,4 @@ COPY --from=build /app/node_modules ./node_modules # Set the command to run the microservice -CMD ["sh", "-c", "cd libs/prisma-service && npx prisma migrate deploy && cd ../.. && node dist/apps/issuance/main.js"] +CMD ["sh", "-c", "cd libs/prisma-service && npx prisma migrate deploy && npx prisma db seed && cd ../.. && node dist/apps/issuance/main.js"] \ No newline at end of file diff --git a/Dockerfiles/Dockerfile.ledger b/Dockerfiles/Dockerfile.ledger index 023a767dc..8355392d8 100644 --- a/Dockerfiles/Dockerfile.ledger +++ b/Dockerfiles/Dockerfile.ledger @@ -1,6 +1,10 @@ # Stage 1: Build the application FROM node:18-alpine as build RUN npm install -g pnpm + +# Add PostgreSQL client to the image +RUN apk add --no-cache postgresql-client + # Set the working directory WORKDIR /app @@ -8,13 +12,20 @@ WORKDIR /app COPY package.json ./ #COPY package-lock.json ./ -# Install dependencies -RUN pnpm i +# Install dependencies safely +RUN pnpm i --ignore-scripts \ + && pnpm add -D ts-node typescript @types/node --ignore-scripts + # Copy the rest of the application code COPY . . + +RUN chown -R node:node /app/libs/prisma-service/prisma/scripts/ +RUN chmod +x /app/libs/prisma-service/prisma/scripts/geo_location_data_import.sh +RUN chmod +x /app/libs/prisma-service/prisma/scripts/update_client_credential_data.sh + # RUN cd libs/prisma-service && npx prisma migrate deploy && npx prisma generate -RUN cd libs/prisma-service && npx prisma migrate deploy && npx prisma generate +RUN cd libs/prisma-service && npx prisma migrate deploy && npx prisma generate && npx prisma db seed # Build the ledger service RUN npm run build ledger @@ -35,4 +46,4 @@ COPY --from=build /app/libs/ ./libs/ COPY --from=build /app/node_modules ./node_modules # Set the command to run the microservice -CMD ["sh", "-c", "cd libs/prisma-service && npx prisma migrate deploy && cd ../.. && node dist/apps/ledger/main.js"] +CMD ["sh", "-c", "cd libs/prisma-service && npx prisma migrate deploy && npx prisma db seed && cd ../.. && node dist/apps/ledger/main.js"] \ No newline at end of file diff --git a/Dockerfiles/Dockerfile.notification b/Dockerfiles/Dockerfile.notification index ffa746fd0..06995f650 100644 --- a/Dockerfiles/Dockerfile.notification +++ b/Dockerfiles/Dockerfile.notification @@ -1,6 +1,10 @@ # Stage 1: Build the application FROM node:18-alpine as build RUN npm install -g pnpm --ignore-scripts + +# Add PostgreSQL client to the image +RUN apk add --no-cache postgresql-client + # Set the working directory WORKDIR /app @@ -8,13 +12,20 @@ WORKDIR /app COPY package.json ./ #COPY package-lock.json ./ -# Install dependencies -RUN pnpm i --ignore-scripts +# Install dependencies safely +RUN pnpm i --ignore-scripts \ + && pnpm add -D ts-node typescript @types/node --ignore-scripts + # Copy the rest of the application code COPY . . + +RUN chown -R node:node /app/libs/prisma-service/prisma/scripts/ +RUN chmod +x /app/libs/prisma-service/prisma/scripts/geo_location_data_import.sh +RUN chmod +x /app/libs/prisma-service/prisma/scripts/update_client_credential_data.sh + # RUN cd libs/prisma-service && npx prisma migrate deploy && npx prisma generate -RUN cd libs/prisma-service && npx prisma migrate deploy && npx prisma generate +RUN cd libs/prisma-service && npx prisma migrate deploy && npx prisma generate && npx prisma db seed # Build the notification service RUN npm run build notification @@ -35,4 +46,4 @@ COPY --from=build /app/libs/ ./libs/ COPY --from=build /app/node_modules ./node_modules # Set the command to run the microservice -CMD ["sh", "-c", "cd libs/prisma-service && npx prisma migrate deploy && cd ../.. && node dist/apps/notification/main.js"] +CMD ["sh", "-c", "cd libs/prisma-service && npx prisma migrate deploy && npx prisma db seed && cd ../.. && node dist/apps/notification/main.js"] \ No newline at end of file diff --git a/Dockerfiles/Dockerfile.organization b/Dockerfiles/Dockerfile.organization index 994c25970..8c1bec37b 100644 --- a/Dockerfiles/Dockerfile.organization +++ b/Dockerfiles/Dockerfile.organization @@ -1,19 +1,30 @@ # Stage 1: Build the application FROM node:18-alpine as build RUN npm install -g pnpm + +# Add PostgreSQL client to the image +RUN apk add --no-cache postgresql-client + # Set the working directory WORKDIR /app # Copy package.json and package-lock.json COPY package.json ./ -# Install dependencies -RUN pnpm i +# Install dependencies safely +RUN pnpm i --ignore-scripts \ + && pnpm add -D ts-node typescript @types/node --ignore-scripts + # Copy the rest of the application code COPY . . + +RUN chown -R node:node /app/libs/prisma-service/prisma/scripts/ +RUN chmod +x /app/libs/prisma-service/prisma/scripts/geo_location_data_import.sh +RUN chmod +x /app/libs/prisma-service/prisma/scripts/update_client_credential_data.sh + # RUN cd libs/prisma-service && npx prisma migrate deploy && npx prisma generate -RUN cd libs/prisma-service && npx prisma migrate deploy && npx prisma generate +RUN cd libs/prisma-service && npx prisma migrate deploy && npx prisma generate && npx prisma db seed # Build the organization service @@ -35,4 +46,4 @@ COPY --from=build /app/libs/ ./libs/ COPY --from=build /app/node_modules ./node_modules # Set the command to run the microservice -CMD ["sh", "-c", "cd libs/prisma-service && npx prisma migrate deploy && cd ../.. && node dist/apps/organization/main.js"] +CMD ["sh", "-c", "cd libs/prisma-service && npx prisma migrate deploy && npx prisma db seed && cd ../.. && node dist/apps/organization/main.js"] \ No newline at end of file diff --git a/Dockerfiles/Dockerfile.user b/Dockerfiles/Dockerfile.user index 68d6e7ada..0ada8ea22 100644 --- a/Dockerfiles/Dockerfile.user +++ b/Dockerfiles/Dockerfile.user @@ -2,6 +2,9 @@ FROM node:18-slim as build RUN npm install -g pnpm +# Add PostgreSQL client to the image +RUN apk add --no-cache postgresql-client + # We don't need the standalone Chromium ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true ENV PUPPETEER_SKIP_DOWNLOAD true @@ -22,13 +25,20 @@ WORKDIR /app # Copy package.json and package-lock.json COPY package.json ./ -# Install dependencies -RUN pnpm install +# Install dependencies safely +RUN pnpm i --ignore-scripts \ + && pnpm add -D ts-node typescript @types/node --ignore-scripts + # Copy the rest of the application code COPY . . + +RUN chown -R node:node /app/libs/prisma-service/prisma/scripts/ +RUN chmod +x /app/libs/prisma-service/prisma/scripts/geo_location_data_import.sh +RUN chmod +x /app/libs/prisma-service/prisma/scripts/update_client_credential_data.sh + # RUN cd libs/prisma-service && npx prisma migrate deploy && npx prisma generate -RUN cd libs/prisma-service && npx prisma migrate deploy && npx prisma generate +RUN cd libs/prisma-service && npx prisma migrate deploy && npx prisma generate && npx prisma db seed # Build the user service RUN pnpm run build user @@ -63,4 +73,4 @@ COPY --from=build /app/node_modules ./node_modules # Set the command to run the microservice -CMD ["sh", "-c", "cd libs/prisma-service && npx prisma migrate deploy && cd ../.. && node dist/apps/user/main.js"] +CMD ["sh", "-c", "cd libs/prisma-service && npx prisma migrate deploy && npx prisma db seed && cd ../.. && node dist/apps/user/main.js"] \ No newline at end of file diff --git a/Dockerfiles/Dockerfile.utility b/Dockerfiles/Dockerfile.utility index f401dae96..d5a223f8a 100644 --- a/Dockerfiles/Dockerfile.utility +++ b/Dockerfiles/Dockerfile.utility @@ -2,6 +2,9 @@ FROM node:18-slim as build RUN npm install -g pnpm +# Add PostgreSQL client to the image +RUN apk add --no-cache postgresql-client + RUN apt-get update -y RUN apt-get --no-install-recommends install -y openssl # Set the working directory @@ -10,13 +13,20 @@ WORKDIR /app # Copy package.json and package-lock.json COPY package.json ./ -# Install dependencies -RUN pnpm install +# Install dependencies safely +RUN pnpm i --ignore-scripts \ + && pnpm add -D ts-node typescript @types/node --ignore-scripts + # Copy the rest of the application code COPY . . + +RUN chown -R node:node /app/libs/prisma-service/prisma/scripts/ +RUN chmod +x /app/libs/prisma-service/prisma/scripts/geo_location_data_import.sh +RUN chmod +x /app/libs/prisma-service/prisma/scripts/update_client_credential_data.sh + # RUN cd libs/prisma-service && npx prisma migrate deploy && npx prisma generate -RUN cd libs/prisma-service && npx prisma migrate deploy && npx prisma generate +RUN cd libs/prisma-service && npx prisma migrate deploy && npx prisma generate && npx prisma db seed # Build the user service RUN pnpm run build utility @@ -40,4 +50,4 @@ COPY --from=build /app/node_modules ./node_modules # Set the command to run the microservice -CMD ["sh", "-c", "cd libs/prisma-service && npx prisma migrate deploy && cd ../.. && node dist/apps/utility/main.js"] +CMD ["sh", "-c", "cd libs/prisma-service && npx prisma migrate deploy && npx prisma db seed && cd ../.. && node dist/apps/utility/main.js"] \ No newline at end of file diff --git a/Dockerfiles/Dockerfile.verification b/Dockerfiles/Dockerfile.verification index 85524a381..64571f23a 100644 --- a/Dockerfiles/Dockerfile.verification +++ b/Dockerfiles/Dockerfile.verification @@ -1,19 +1,30 @@ # Stage 1: Build the application FROM node:18-alpine as build RUN npm install -g pnpm + +# Add PostgreSQL client to the image +RUN apk add --no-cache postgresql-client + # Set the working directory WORKDIR /app # Copy package.json and package-lock.json COPY package.json ./ -# Install dependencies -RUN pnpm i +# Install dependencies safely +RUN pnpm i --ignore-scripts \ + && pnpm add -D ts-node typescript @types/node --ignore-scripts + # Copy the rest of the application code COPY . . + +RUN chown -R node:node /app/libs/prisma-service/prisma/scripts/ +RUN chmod +x /app/libs/prisma-service/prisma/scripts/geo_location_data_import.sh +RUN chmod +x /app/libs/prisma-service/prisma/scripts/update_client_credential_data.sh + # RUN cd libs/prisma-service && npx prisma migrate deploy && npx prisma generate -RUN cd libs/prisma-service && npx prisma migrate deploy && npx prisma generate +RUN cd libs/prisma-service && npx prisma migrate deploy && npx prisma generate && npx prisma db seed # Build the user service RUN npm run build verification @@ -33,4 +44,4 @@ COPY --from=build /app/libs/ ./libs/ COPY --from=build /app/node_modules ./node_modules # Set the command to run the microservice -CMD ["sh", "-c", "cd libs/prisma-service && npx prisma migrate deploy && cd ../.. && node dist/apps/verification/main.js"] \ No newline at end of file +CMD ["sh", "-c", "cd libs/prisma-service && npx prisma migrate deploy && npx prisma db seed && cd ../.. && node dist/apps/verification/main.js"] \ No newline at end of file diff --git a/Dockerfiles/Dockerfile.webhook b/Dockerfiles/Dockerfile.webhook index b148e1bd6..e7054f68e 100644 --- a/Dockerfiles/Dockerfile.webhook +++ b/Dockerfiles/Dockerfile.webhook @@ -1,6 +1,10 @@ # Stage 1: Build the application FROM node:18-alpine as build RUN npm install -g pnpm + +# Add PostgreSQL client to the image +RUN apk add --no-cache postgresql-client + # Set the working directory WORKDIR /app @@ -8,13 +12,20 @@ WORKDIR /app COPY package.json ./ #COPY package-lock.json ./ -# Install dependencies -RUN pnpm i +# Install dependencies safely +RUN pnpm i --ignore-scripts \ + && pnpm add -D ts-node typescript @types/node --ignore-scripts + # Copy the rest of the application code COPY . . + +RUN chown -R node:node /app/libs/prisma-service/prisma/scripts/ +RUN chmod +x /app/libs/prisma-service/prisma/scripts/geo_location_data_import.sh +RUN chmod +x /app/libs/prisma-service/prisma/scripts/update_client_credential_data.sh + # RUN cd libs/prisma-service && npx prisma migrate deploy && npx prisma generate -RUN cd libs/prisma-service && npx prisma migrate deploy && npx prisma generate +RUN cd libs/prisma-service && npx prisma migrate deploy && npx prisma generate && npx prisma db seed # Build the webhook service RUN pnpm run build webhook @@ -36,4 +47,4 @@ COPY --from=build /app/node_modules ./node_modules # Set the command to run the microservice -CMD ["sh", "-c", "cd libs/prisma-service && npx prisma migrate deploy && cd ../.. && node dist/apps/webhook/main.js"] +CMD ["sh", "-c", "cd libs/prisma-service && npx prisma migrate deploy && npx prisma db seed && cd ../.. && node dist/apps/webhook/main.js"] \ No newline at end of file diff --git a/libs/prisma-service/prisma/scripts/geo_location_data_import.sh b/libs/prisma-service/prisma/scripts/geo_location_data_import.sh index e598ce5f8..61247b088 100755 --- a/libs/prisma-service/prisma/scripts/geo_location_data_import.sh +++ b/libs/prisma-service/prisma/scripts/geo_location_data_import.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # Database connection details DB_URL=$1 diff --git a/libs/prisma-service/prisma/scripts/update_client_credential_data.sh b/libs/prisma-service/prisma/scripts/update_client_credential_data.sh index 2b6d49a54..ef104edbe 100755 --- a/libs/prisma-service/prisma/scripts/update_client_credential_data.sh +++ b/libs/prisma-service/prisma/scripts/update_client_credential_data.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # Database connection URL DB_URL=$1