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

Docker single executable / memory consumption #2757

Open
predaytor opened this issue Nov 12, 2024 · 1 comment
Open

Docker single executable / memory consumption #2757

predaytor opened this issue Nov 12, 2024 · 1 comment

Comments

@predaytor
Copy link

Is it possible to reduce memory consumption with Fresh 2.0? Currently deployed on fly.io on a 1024MB machine, while a similar application on Node.js consumes around 190-220MB of RAM. Maybe we can create a single executable and get rid of typescript transpilation at runtime? Very thanks.

FROM denoland/deno:debian

WORKDIR /app

COPY . .

RUN deno task build

EXPOSE 80

CMD ["run", "-A", "main.ts"]
@predaytor
Copy link
Author

Will this be possible with the release of Deno 2.1.0?

denoland/deno#26939

To include files or directories in the executable, specify them via the --include <path> flag.

deno compile --include names.csv --include data main.ts

Then read the file relative to the directory path of the current module via import.meta.dirname:

// main.ts
const names = Deno.readTextFileSync(import.meta.dirname + "/names.csv");
const dataFiles = Deno.readDirSync(import.meta.dirname + "/data");

// use names and dataFiles here

Note this currently only works for files on the file system and not remote
files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant