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

chore(server): build prod Docker image #2

Merged
merged 1 commit into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
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
Binary file modified bun.lockb
Binary file not shown.
1 change: 1 addition & 0 deletions server/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
18 changes: 12 additions & 6 deletions server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
4 changes: 2 additions & 2 deletions server/fly.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
13 changes: 0 additions & 13 deletions server/render.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion server/src/lib/run-snarkjs-verification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 3 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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==
Expand Down
Loading