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

refactor(domain): move the database schema next to application business rules #66

Merged
merged 8 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
chore(core): optimize the docker build
  • Loading branch information
tericcabrel committed May 21, 2024
commit a00e7ae8e884e5cc43b5784dcfb7698cfd53ad6c
22 changes: 5 additions & 17 deletions apps/core/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ WORKDIR /app
COPY --chown=node:node --from=builder /app/packages/domain/prisma/schema.prisma ./app/prisma/

# Generate the Prisma query engine for Node Alpine
RUN npx prisma generate --schema=./app/prisma/schema.prisma

RUN npx prisma generate --schema=./app/prisma/schema.prisma && \
rm ./node_modules/.prisma/client/libquery_engine-rhel-openssl-1.0.x.so.node
# https://www.prisma.io/docs/orm/reference/prisma-schema-reference#binarytargets-options

FROM node:20-alpine AS runner

Expand All @@ -44,7 +45,6 @@ COPY --chown=node:node --from=builder /app/apps/core/package.json ./apps/core

COPY --chown=node:node --from=builder /app/packages/domain/package.json ./packages/domain/package.json
COPY --chown=node:node --from=builder /app/packages/domain/dist ./packages/domain/dist
COPY --chown=node:node --from=builder /app/packages/domain/node_modules/.prisma ./packages/domain/node_modules/.prisma

COPY --chown=node:node --from=builder /app/packages/utils/package.json ./packages/utils/package.json
COPY --chown=node:node --from=builder /app/packages/utils/dist ./packages/utils/dist
Expand All @@ -55,21 +55,9 @@ COPY --chown=node:node --from=builder /app/packages/embed/dist ./packages/embed/
COPY --chown=node:node --from=builder /app/packages/logger/package.json ./packages/logger/package.json
COPY --chown=node:node --from=builder /app/packages/logger/dist ./packages/logger/dist

# COPY --chown=node:node --from=builder /app/packages/domain/package.json ./node_modules/@snipcode/domain/package.json
# COPY --chown=node:node --from=builder /app/packages/domain/dist ./node_modules/@snipcode/domain/dist
# COPY --chown=node:node --from=builder /app/packages/domain/node_modules/.prisma ./node_modules/@snipcode/domain/node_modules/.prisma


RUN yarn install
# RUN yarn workspaces focus # && yarn cache clean

# COPY --chown=node:node --from=schema-builder /app/node_modules/.prisma/client/schema.prisma ./node_modules/.prisma/client
# COPY --chown=node:node --from=schema-builder /app/node_modules/.prisma/client/libquery_engine-linux-musl.so.node ./node_modules/.prisma/client
# COPY --chown=node:node --from=schema-builder /app/node_modules/@prisma/client ./packages/domain/node_modules/@prisma/client
# COPY --chown=node:node --from=schema-builder /app/node_modules/@prisma/client ./node_modules/@prisma/client
RUN yarn workspaces focus --all --production && yarn cache clean --all

# RUN rm -rf ./packages/domain/node_modules/@prisma/client
COPY --chown=node:node --from=schema-builder /app/node_modules/.prisma/client ./packages/domain/node_modules/.prisma/client
COPY --chown=node:node --from=schema-builder /app/node_modules/.prisma/client ./node_modules/.prisma/client

EXPOSE 7501

Expand Down
2 changes: 1 addition & 1 deletion apps/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"apollo-server-express": "3.13.0",
"axios": "1.6.8",
"cors": "2.8.5",
"dotenv": "16.4.5",
"express": "4.19.1",
"graphql": "16.8.1"
},
Expand All @@ -33,7 +34,6 @@
"@graphql-codegen/typescript-resolvers": "4.0.6",
"@types/cors": "2.8.17",
"@types/express": "4.17.21",
"esbuild": "0.20.2",
"nodemon": "3.1.0"
}
}
2 changes: 1 addition & 1 deletion packages/domain/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@
},
"dependencies": {
"@bugsnag/cuid": "3.1.1",
"@prisma/client": "5.14.0",
"@snipcode/utils": "workspace:*",
"axios": "1.6.8",
"bcryptjs": "2.4.3",
"unique-username-generator": "1.3.0"
},
"devDependencies": {
"@ngneat/falso": "7.2.0",
"@prisma/client": "5.14.0",
"@types/bcryptjs": "2.4.6",
"nock": "13.5.4",
"prisma": "5.14.0",
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5430,7 +5430,7 @@ __metadata:
apollo-server-express: "npm:3.13.0"
axios: "npm:1.6.8"
cors: "npm:2.8.5"
esbuild: "npm:0.20.2"
dotenv: "npm:16.4.5"
express: "npm:4.19.1"
graphql: "npm:16.8.1"
nodemon: "npm:3.1.0"
Expand Down