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

deno compile example? #369

Open
AFCMS opened this issue Jun 4, 2024 · 0 comments
Open

deno compile example? #369

AFCMS opened this issue Jun 4, 2024 · 0 comments

Comments

@AFCMS
Copy link

AFCMS commented Jun 4, 2024

Currently the README explains how to use deno with the deno run command inside the Docker images.

But there are no examples for using deno compile

I have tried to do so, but I didn't succeed, getting an error like that:

 => ERROR [build 10/10] RUN deno compile --output /app/custom_binary --allow-read=".env,.env.defaults,.env.example" --allow-net main.ts                           2.5s 
------                                                                                                                                                                    
 > [build 10/10] RUN deno compile --output /app/custom_binary --allow-read=".env,.env.defaults,.env.example" --allow-net main.ts:                                      
0.268 Check file:///app/main.ts                                                                                                                                           
0.368 Compile file:///app/main.ts to /app/custom_binary                                                                                                                
0.368 Download https://dl.deno.land/release/v1.44.0/denort-x86_64-unknown-linux-gnu.zip                                                                                   
1.775 Archive:  /tmp/.tmpyRVvzh/denort.zip
1.775   inflating: denort                  
2.365 error: Writing /app/custom_binary
2.365 
2.365 Caused by:
2.365     No such file or directory (os error 2)
------
Dockerfile:16
--------------------
  14 |     RUN ls -la && exit 0
  15 |     
  16 | >>> RUN deno compile --output /app/custom_binary --allow-read=".env,.env.defaults,.env.example" --allow-net main.ts
  17 |     
  18 |     FROM alpine as runtime
--------------------
ERROR: failed to solve: process "/bin/sh -c deno compile --output /app/custom_binary --allow-read=\".env,.env.defaults,.env.example\" --allow-net main.ts" did not complete successfully: exit code: 1
FROM denoland/deno:alpine as build

RUN apk add --no-cache unzip

WORKDIR /app

COPY deno.json /app/
COPY deno.lock /app/
COPY main.ts /app/
COPY schema.gen.ts /app/

RUN deno cache main.ts

RUN deno compile --output /app/custom_binary --allow-read=".env,.env.defaults,.env.example" --allow-net main.ts

FROM alpine as runtime

COPY --from=build /app/custom_binary /app/

CMD [ "/app/custom_binary" ]
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