diff --git a/bun.lockb b/bun.lockb index 77a164c..30d9f23 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/server/.dockerignore b/server/.dockerignore new file mode 100644 index 0000000..3c3629e --- /dev/null +++ b/server/.dockerignore @@ -0,0 +1 @@ +node_modules diff --git a/server/Dockerfile b/server/Dockerfile index 8a60985..c951828 100644 --- a/server/Dockerfile +++ b/server/Dockerfile @@ -3,13 +3,19 @@ FROM node:20-alpine as base RUN apk update && apk upgrade && apk add dumb-init && apk add --no-cache bash WORKDIR app -COPY *.json . +FROM base as build +COPY *.json ./ COPY src ./src +RUN npm i -g pnpm &&\ + pnpm i &&\ + pnpm tsc &&\ + rm -fr node_modules &&\ + pnpm i --prod -RUN npm i -g pnpm && pnpm i - -EXPOSE 3000 +FROM base as release +COPY --from=build /app/dist ./dist +COPY --from=build /app/node_modules ./node_modules +EXPOSE 3001 ENV NODE_ENV=production - ENTRYPOINT ["/usr/bin/dumb-init", "--"] -CMD ["pnpm", "dev"] +CMD ["node", "dist"] diff --git a/server/fly.toml b/server/fly.toml index fcae878..78f1038 100644 --- a/server/fly.toml +++ b/server/fly.toml @@ -8,13 +8,13 @@ primary_region = 'ams' [env] HOST = '0.0.0.0' - PORT = '3001' + PORT = 3001 SCOPE = 'dog18' [build] [http_service] - internal_port = 3000 + internal_port = 3001 force_https = true auto_stop_machines = true auto_start_machines = true diff --git a/server/package.json b/server/package.json index 4a8d60c..e7e624f 100644 --- a/server/package.json +++ b/server/package.json @@ -19,6 +19,7 @@ "@types/node-forge": "^1.3.11", "@types/pkijs": "^3.0.1", "@types/snarkjs": "^0.7.8", - "ts-node": "^10.9.2" + "ts-node": "^10.9.2", + "typescript": "^5.5.4" } } diff --git a/server/render.yaml b/server/render.yaml deleted file mode 100644 index b98a7db..0000000 --- a/server/render.yaml +++ /dev/null @@ -1,13 +0,0 @@ -services: - - type: web - name: prndog-server - runtime: node - repo: https://github.com/prndog/prndog - plan: free - envVars: - - key: BUN_VERSION - value: 1.1.18 - region: oregon - buildCommand: bun install - startCommand: bun start -version: '1' diff --git a/server/src/lib/run-snarkjs-verification.ts b/server/src/lib/run-snarkjs-verification.ts index 27dd01b..cf721da 100644 --- a/server/src/lib/run-snarkjs-verification.ts +++ b/server/src/lib/run-snarkjs-verification.ts @@ -44,7 +44,7 @@ export const runSnarkjsVerification = async ( const proofPath = await writeTempFile('proof.json', proofData) const { stdout, stderr } = await execPromise( - `pnpx snarkjs groth16 verify ${vkeyPath} ${publicSignalsPath} ${proofPath}`, + `npx snarkjs groth16 verify ${vkeyPath} ${publicSignalsPath} ${proofPath}`, ) console.log(stdout) diff --git a/yarn.lock b/yarn.lock index 2e625eb..00c8d05 100644 --- a/yarn.lock +++ b/yarn.lock @@ -911,7 +911,7 @@ client@client: easyqrcodejs "^4.6.1" js-cookie "^3.0.5" lottie-react "^2.4.0" - million "" + million "^3.1.11" next "14.2.8" react "^18" react-dom "^18" @@ -2293,6 +2293,7 @@ server@server: "@types/pkijs" "^3.0.1" "@types/snarkjs" "^0.7.8" ts-node "^10.9.2" + typescript "" dependencies: asn1js "^3.0.5" cors "^2.8.5" @@ -2626,7 +2627,7 @@ type-is@~1.6.18: mime-types "~2.1.24" media-typer "0.3.0" -typescript@>=2.7, typescript@>=3, typescript@^5, typescript@^5.2.2: +typescript@>=2.7, typescript@>=3, typescript@^5, typescript@^5.2.2, typescript@^5.5.4: version "5.5.4" resolved "https://registry.npmjs.org/typescript/-/typescript-5.5.4.tgz" integrity sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q==