Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added dockerfile for ecosystem microservice #121

Merged
merged 1 commit into from
Oct 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions Dockerfiles/Dockerfile.ecosystem
Original file line number Diff line number Diff line change
@@ -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