diff --git a/Dockerfiles/Dockerfile.ecosystem b/Dockerfiles/Dockerfile.ecosystem new file mode 100644 index 000000000..3f258801a --- /dev/null +++ b/Dockerfiles/Dockerfile.ecosystem @@ -0,0 +1,41 @@ +# Stage 1: Build the application +FROM node:18-alpine as build +RUN npm install -g pnpm +# Set the working directory +WORKDIR /app + +# Copy package.json and package-lock.json +COPY package.json ./ +#COPY package-lock.json ./ + +# Install dependencies +RUN pnpm i + +# Copy the rest of the application code +COPY . . +RUN cd libs/prisma-service && npx prisma migrate deploy && npx prisma generate + +# Build the issuance service +RUN pnpm run build ecosystem + +# Stage 2: Create the final image +FROM node:18-alpine +RUN npm install -g pnpm +# Set the working directory +WORKDIR /app + +# Copy the compiled code from the build stage +COPY --from=build /app/dist/apps/ecosystem/ ./dist/apps/ecosystem/ + +# Copy the libs folder from the build stage +COPY --from=build /app/libs/ ./libs/ +#COPY --from=build /app/package.json ./ +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 && npx prisma generate && cd ../.. && node dist/apps/ecosystem/main.js"] + +# docker build -t ecosystem -f Dockerfiles/Dockerfile.ecosystem . +# docker run -d --env-file .env --name ecosystem docker.io/library/ecosystem +# docker logs -f ecosystem