Comments (10)
I don't know what does it do to docker image exactly but it completely ignores all the cache. The only thing I can think of is that .cache directory is used by pip too which in case of gcloud-sdk image might be something that google fiddles with at runtime.
FYI you can control the path of cache directory by
DENO_DIR
env var. Setting it to some different path might also work around the issue
That worked!
I'm not sure why google cloud run doesn't like default caching directory but it seems to be the case. As soon as I switched to different directory using:
# set DENO_DIR to avoid conflicts with google cloud
ENV DENO_DIR=./.deno_cache
It works like it suppose to.
from deno_docker.
Sounds like a bug of Deno. https://deno.land/[email protected]/node/module_all.ts
is the module used for enabling npm/node.js compatiblity.
The workaround would be adding the line RUN deno cache https://deno.land/[email protected]/node/module_all.ts
after RUN deno cache **/*.ts
cc @bartlomieju
from deno_docker.
This problem would be transparently solved by denoland/deno#16748, otherwise, we'd need to do some hacks to solve it. @dsherret any thoughts?
from deno_docker.
Sounds like a bug of Deno.
https://deno.land/[email protected]/node/module_all.ts
is the module used for enabling npm/node.js compatiblity.The workaround would be adding the line
RUN deno cache https://deno.land/[email protected]/node/module_all.ts
afterRUN deno cache **/*.ts
cc @bartlomieju
That did help to certain extend. Got a new error now:
An npm specifier not found in cache: "ent"
What is strange I only get this error when building on Gcloud not when running a local docker build 🤔
from deno_docker.
An npm specifier not found in cache: "ent"
What is strange I only get this error when building on Gcloud not when running a local docker build 🤔
Sounds like npm:ent
is not cached for some reason only on Gcloud. What happens if you add RUN deno cache npm:ent
command in your dockerfile?
from deno_docker.
Apparently, there is some weird issue with Gcloud run. I don't know what does it do to docker image exactly but it completely ignores all the cache. The only thing I can think of is that .cache directory is used by pip too which in case of gcloud-sdk image might be something that google fiddles with at runtime.
I tried to download the same docker image that gcloud tries to run and it works perfectly without any cache issues on two different machines.
When tried to deploy that same instance to gcloud it fails miserably and cannot find any cache.
The workaround I have found is to bundle all dependencies using deno bundle
inside docker image and run from .js
file instead.
Probably, get the same result with less moving parts.
from deno_docker.
I don't know what does it do to docker image exactly but it completely ignores all the cache. The only thing I can think of is that .cache directory is used by pip too which in case of gcloud-sdk image might be something that google fiddles with at runtime.
FYI you can control the path of cache directory by DENO_DIR
env var. Setting it to some different path might also work around the issue
from deno_docker.
I just realized that Dockerfiles other than bin-
version already set ENV
and probably don't have this problem. Do you have any specific reason to use bin
instead of ubuntu, alpine, etc?
from deno_docker.
Sorry to jump in! I suspected it might be caused that you're on root
user, so I tried to change the exec user as nonroot.
It worked!
I confirmed this is working on Cloud Run. I do not have a fully explanation here because I couldn't find a specific doc about user limitation on Cloud Run (I'm a Google Developer Expert but I'm mainly active in GKE and Kubernetes community.) But can you take a look if this approach works for you? @Maxim-Filimonov
Btw ADD
is not Dockerfile bast practice so I changed it to COPY :)
ARG DENO_VERSION=1.30.0
FROM denoland/deno:bin-$DENO_VERSION AS deno
# debian based
FROM gcr.io/google.com/cloudsdktool/cloud-sdk:slim
ARG USERNAME=deno
ARG GROUPNAME=deno
ARG UID=1001
ARG GID=1001
RUN groupadd -g $GID $GROUPNAME && \
useradd -m -u $UID -g $GID $USERNAME
USER $USERNAME
WORKDIR /home/$USERNAME/app
COPY --from=deno /deno /usr/local/bin/deno
# # These steps will be re-run upon each file change in your working directory:
COPY deps.ts .
RUN deno cache deps.ts
COPY . .
RUN deno cache **/*.ts
EXPOSE 8000
ENTRYPOINT ["/usr/local/bin/deno"]
CMD ["run", "--cached-only", "--allow-env", "--allow-read", "--allow-write", "--allow-run", "--allow-net", "./src/http_server.ts"]
from deno_docker.
I just realized that Dockerfiles other than
bin-
version already setENV
and probably don't have this problem. Do you have any specific reason to usebin
instead of ubuntu, alpine, etc?
I used bin based on this example -> https://github.com/denoland/deno_docker#using-your-own-base-image
from deno_docker.
Related Issues (20)
- Create Alpine/APK package for Deno HOT 9
- Tini warning when building 1.28.1 image HOT 3
- Containers for 1.30.0 have Deno CLI version 1.29.4 HOT 2
- Add release workflow HOT 1
- Become a docker verified publisher
- Use Docker official actions
- Document tini HOT 3
- Bash function not working as intended from the documentation
- No tag for 1.36.2 HOT 1
- Permission denied (os error 13) when writing to file from Dockerfile
- Simple express app segfaults in alpine Docker image HOT 2
- Docker sponsorship and/or alternate container registry options HOT 1
- Proposal: Distroless and Alpine image improvements. HOT 3
- Add ARM64 platform to docker images HOT 1
- Alpine ARM64 docker container broken HOT 1
- Latest image (1.40.5) missing unzip HOT 4
- Unable to pull v1.40.5 HOT 2
- Latest image broke nodejs / npm usage (maybe related to libgcc) HOT 5
- Automate tagging
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from deno_docker.