We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent dec8876 commit 58519e4Copy full SHA for 58519e4
1 file changed
nim/content.md
@@ -18,10 +18,22 @@ $ docker run --rm -v "$PWD":/usr/src/app -w /usr/src/app %%IMAGE%% nim c -r main
18
19
## Compile to JavaScript
20
21
-Nim can compile to JavaScript. This image includes Node.js to serve as the runtime:
+Nim can compile to JavaScript:
22
23
```console
24
-$ docker run --rm -v "$PWD":/usr/src/app -w /usr/src/app %%IMAGE%% nim js -r main.nim
+$ docker run --rm -v "$PWD":/usr/src/app -w /usr/src/app %%IMAGE%% nim js main.nim
25
+```
26
+
27
+To compile and run, use a multi-stage Dockerfile with Node.js:
28
29
+```dockerfile
30
+FROM %%IMAGE%% AS builder
31
+COPY . .
32
+RUN nim js -o:app.js src/app.nim
33
34
+FROM node:latest
35
+COPY --from=builder /usr/src/app/app.js .
36
+CMD ["node", "app.js"]
37
```
38
39
## Managing packages with Nimble
0 commit comments