Skip to content

Commit

Permalink
fix: docker build and disabled imported modules
Browse files Browse the repository at this point in the history
  • Loading branch information
froid1911 committed Jan 26, 2024
1 parent 8857139 commit 59324eb
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 34 deletions.
14 changes: 10 additions & 4 deletions api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,21 @@
ARG NODE_VERSION=node:16.14.2

FROM $NODE_VERSION AS dependency-base
ENV PORT=$PORT
ENV DATABASE_URL=$DATABASE_URL
ENV JWT_SECRET=$JWT_SECRET
ENV AUTH_SIGNUP_ENABLED=$AUTH_SIGNUP_ENABLED
ENV JWT_EXPIRATION_PERIOD_SECONDS=$JWT_EXPIRATION_PERIOD_SECONDS

# create destination directory
RUN mkdir -p /app
WORKDIR /app

# copy the app, note .dockerignore
COPY package.json .
COPY package-lock.json .
RUN npm ci
COPY yarn.lock .
COPY Procfile .
RUN yarn install --frozen-lockfile

FROM dependency-base AS production

Expand All @@ -19,7 +25,7 @@ COPY . .
# Run in production mode
ENV NODE_ENV=production
RUN sed --in-place 's/sqlite/postgresql/g' ./prisma/schema.prisma
ENV PORT=3000
RUN npx prisma generate

# initialize db and start the app
CMD npx prisma db push && npm run start
ENTRYPOINT [ "npm", "run", "start" ]
1 change: 1 addition & 0 deletions api/Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: npm run dev
2 changes: 0 additions & 2 deletions api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"type": "module",
"license": "AGPL-3",
"scripts": {
"preinstall": "cd ../module-example && npm ci",
"dev": "vite-node -w src/index.ts",
"start": "NODE_ENV=production vite-node src/index.ts",
"debug": "DEBUG=1 npm run dev",
Expand Down Expand Up @@ -38,7 +37,6 @@
"pino": "^8.11.0",
"pino-http": "^8.3.3",
"pino-pretty": "^10.0.0",
"module-example": "file:../module-example",
"siwe": "^2.1.4",
"vite-node": "^0.29.2",
"vitest": "^0.29.2",
Expand Down
14 changes: 7 additions & 7 deletions api/src/importedModules.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import moduleExample from 'module-example';
import prismaCore from './database';
// import moduleExample from 'module-example';
import prismaCore from "./database";
// Add your main setup function to the list of all setup functions
// Note that order of the modules in the array matters:
// the latest would receive more extended prisma client
const importedModules = [moduleExample];
const importedModules = [];

// Below is the functionality to iterate over all importedModules
// and run their setup logic iteratevely
Expand All @@ -17,15 +17,15 @@ export function setupAllModules() {
}
importedModules.forEach((importedModule) => {
const exported = importedModule(fullyExtendedPrisma);
if (typeof exported !== 'object') {
if (typeof exported !== "object") {
throw new Error(
'function exported from a module should always return an object',
"function exported from a module should always return an object"
);
}
if ('extendedPrisma' in exported) {
if ("extendedPrisma" in exported) {
fullyExtendedPrisma = exported.extendedPrisma;
}
if ('resolvers' in exported) {
if ("resolvers" in exported) {
importedResolvers.push(exported.resolvers);
}
});
Expand Down
21 changes: 0 additions & 21 deletions api/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -994,13 +994,6 @@
resolved "https://registry.yarnpkg.com/@prisma/client/-/client-5.7.1.tgz#a124afd05663267f7255a639a81d28303684a063"
integrity sha512-TUSa4nUcC4nf/e7X3jyO1pEd6XcI/TLRCA0KjkA46RDIpxUaRsBYEOqITwXRW2c0bMFyKcCRXrH4f7h4q9oOlg==

"@prisma/client@^4.11.0":
version "4.16.2"
resolved "https://registry.yarnpkg.com/@prisma/client/-/client-4.16.2.tgz#3bb9ebd49b35c8236b3d468d0215192267016e2b"
integrity sha512-qCoEyxv1ZrQ4bKy39GnylE8Zq31IRmm8bNhNbZx7bF2cU5aiCCnSa93J2imF88MBjn7J9eUQneNxUQVJdl/rPQ==
dependencies:
"@prisma/engines-version" "4.16.1-1.4bc8b6e1b66cb932731fb1bdbbc550d1e010de81"

"@prisma/client@^5.7.1":
version "5.8.1"
resolved "https://registry.yarnpkg.com/@prisma/client/-/client-5.8.1.tgz#7815ec51c0ca2a6de219c02e7846701ae3baf240"
Expand All @@ -1011,11 +1004,6 @@
resolved "https://registry.yarnpkg.com/@prisma/debug/-/debug-5.8.1.tgz#704daa36919b0fc4d227260ecebfa1c94b155b07"
integrity sha512-tjuw7eA0Us3T42jx9AmAgL58rzwzpFGYc3R7Y4Ip75EBYrKMBA1YihuWMcBC92ILmjlQ/u3p8VxcIE0hr+fZfg==

"@prisma/engines-version@4.16.1-1.4bc8b6e1b66cb932731fb1bdbbc550d1e010de81":
version "4.16.1-1.4bc8b6e1b66cb932731fb1bdbbc550d1e010de81"
resolved "https://registry.yarnpkg.com/@prisma/engines-version/-/engines-version-4.16.1-1.4bc8b6e1b66cb932731fb1bdbbc550d1e010de81.tgz#d3b5dcf95b6d220e258cbf6ae19b06d30a7e9f14"
integrity sha512-q617EUWfRIDTriWADZ4YiWRZXCa/WuhNgLTVd+HqWLffjMSPzyM5uOWoauX91wvQClSKZU4pzI4JJLQ9Kl62Qg==

"@prisma/[email protected]":
version "5.8.1-1.78caf6feeaed953168c64e15a249c3e9a033ebe2"
resolved "https://registry.yarnpkg.com/@prisma/engines-version/-/engines-version-5.8.1-1.78caf6feeaed953168c64e15a249c3e9a033ebe2.tgz#f600a45afc4cf0c0356b6ed90add6050fa3f3239"
Expand Down Expand Up @@ -1977,9 +1965,6 @@ document-drive@powerhouse-inc/document-drive#0fac28b:
version "0.0.22"
resolved "https://codeload.github.com/powerhouse-inc/document-drive/tar.gz/0fac28b6f3de37b13899075c88fd37a9ce355013"
dependencies:
"@prisma/client" "5.7.1"
graphql "^16.8.1"
graphql-request "^6.1.0"
sanitize-filename "^1.6.3"

document-model-libs@^1.1.34:
Expand Down Expand Up @@ -3343,12 +3328,6 @@ mlly@^1.1.0, mlly@^1.2.0:
pkg-types "^1.0.3"
ufo "^1.3.2"

"module-example@file:../module-example":
version "0.0.1"
dependencies:
"@prisma/client" "^4.11.0"
nexus "^1.3.0"

[email protected]:
version "2.0.0"
resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8"
Expand Down

0 comments on commit 59324eb

Please sign in to comment.