denoland / deno_docker Goto Github PK
View Code? Open in Web Editor NEWLatest dockerfiles and images for Deno - alpine, centos, debian, ubuntu
Home Page: https://hub.docker.com/r/denoland/deno
License: MIT License
Latest dockerfiles and images for Deno - alpine, centos, debian, ubuntu
Home Page: https://hub.docker.com/r/denoland/deno
License: MIT License
Currently, we have to manually specify the version tag, as even latest
is not defined :
$ docker run hayd/deno
docker: Error response from daemon: manifest for hayd/deno:latest not found: manifest unknown: manifest unknown.
Generic labels might be preferable for version control. It's easier to keep software up to date, especially with Deno which is evolving a lot :
$ docker run -p 8080:8080 -v $PWD:/app hayd/deno:alpine --allow-net index.ts
What about the Node docker images format ?
USE ARG DEBIAN_FRONTEND=noninteractive
instead of ENV DEBIAN_FRONTEND=noninteractive
is much better.
https://docs.docker.com/engine/faq/#why-is-debian_frontendnoninteractive-discouraged-in-dockerfiles
These labels provides a standardized way of retrieving useful information for different images. They are explained at:
https://github.com/opencontainers/image-spec/blob/main/annotations.md
The easiest way to adopt it is to use the Docker Metadata Action.
Hello,
I can run my app without any problems on my machine. However, with this Dockerfile:
FROM hayd/alpine-deno:1.0.5
EXPOSE 7700
WORKDIR /app
USER deno
ADD . .
RUN deno cache --unstable **/*.ts # Unstable flag, because without it I have an error prompting me to run with this flag
RUN ["run", "--allow-net", "--allow-env", "--allow-run", "--allow-write", "--allow-read", "--unstable", "app.ts"]
I have this error:
Compile file:///app/models/app.model.ts
error: TS2345 [ERROR]: Argument of type '"file" | "dir" | "symlink" | undefined' is not assignable to parameter of type 'SymlinkOptions | undefined'.
Type '"file"' is not assignable to type 'SymlinkOptions | undefined'.
await Deno.symlink(originSrcFilePath, dest, type);
~~~~
at https://deno.land/[email protected]/fs/copy.ts:114:47
TS2345 [ERROR]: Argument of type '"file" | "dir" | "symlink" | undefined' is not assignable to parameter of type 'SymlinkOptions | undefined'.
Type '"file"' is not assignable to type 'SymlinkOptions | undefined'.
Deno.symlinkSync(originSrcFilePath, dest, type);
~~~~
at https://deno.land/[email protected]/fs/copy.ts:132:45
TS2345 [ERROR]: Argument of type '"file" | "dir" | "symlink" | undefined' is not assignable to parameter of type 'SymlinkOptions | undefined'.
Type '"file"' is not assignable to type 'SymlinkOptions | undefined'.
await Deno.symlink(src, dest, srcFilePathType);
~~~~~~~~~~~~~~~
at https://deno.land/[email protected]/fs/ensure_symlink.ts:31:33
TS2345 [ERROR]: Argument of type '"file" | "dir" | "symlink" | undefined' is not assignable to parameter of type 'SymlinkOptions | undefined'.
Type '"file"' is not assignable to type 'SymlinkOptions | undefined'.
Deno.symlinkSync(src, dest, srcFilePathType);
~~~~~~~~~~~~~~~
at https://deno.land/[email protected]/fs/ensure_symlink.ts:58:31
Found 4 errors.
The command '/bin/sh -c deno cache --unstable **/*.ts' returned a non-zero code: 1
On my local machine, I have the following versions.
deno 1.0.0
v8 8.4.300
typescript 3.9.2
I am sorry if the issue is not related to the Docker image, but what do you think this can be related to? Versions?
Thank you in advance.
Hi!
import { Application } from 'https://deno.land/x/[email protected]/mod.ts'
const app = new Application()
const test = 'Test string'
const encoder = new TextEncoder()
const data = encoder.encode(test)
app.get('/', async (c) => {
await Deno.writeFile('test.txt', data)
return test
})
app.start({
port: 8080
})
it allows you to understand how the file is being created and written.
FROM hayd/alpine-deno:1.7.2
EXPOSE 8080
WORKDIR /app
USER deno
ADD . .
RUN deno cache app.js
CMD ["run", "--allow-net", "--allow-read", "--allow-write", "app.js"]
docker build -t app . && docker run -it --init -p 8080:8080 app
Without writing files, everything works fine, but if create and write files, I see an error:
I test this example with Alpine Linux & CentOS
I'm doing this for the first time, maybe it's a simple task, but please tell me how to fix it?
Was on hayd/deno where /usr/bin/env is implemented by BusyBox v1.31.1, and -S
option is not implemented.
However passing parameters to deno is a must, and env -S
is one of the common methods.
Is there already a deno image supporting env -S
, or, could it be added somehow ?
❯ docker version
Client: Docker Engine - Community
Version: 19.03.12
API version: 1.40
Go version: go1.13.10
Git commit: 48a66213fe
Built: Mon Jun 22 15:41:33 2020
OS/Arch: darwin/amd64
Experimental: false
Server: Docker Engine - Community
Engine:
Version: 19.03.12
API version: 1.40 (minimum version 1.12)
Go version: go1.13.10
Git commit: 48a66213fe
Built: Mon Jun 22 15:49:27 2020
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: v1.2.13
GitCommit: 7ad184331fa3e55e52b890ea95e65ba581ae3429
runc:
Version: 1.0.0-rc10
GitCommit: dc9208a3303feef5b3839f4323d9beb36df0a9dd
docker-init:
Version: 0.18.0
GitCommit: fec3683**
https://github.com/guzhongren/deno-restful-api-with-postgresql-tdd
❯ docker-compose ps
Name Command State Ports
-----------------------------------------------------------------------------------------------------------------------
deno-restful-api-with-postgresql-tdd_db_1 docker-entrypoint.sh postgres Up 0.0.0.0:5432->5432/tcp
deno-restful-api-with-postgresql-tdd_pgadmin_1 /entrypoint.sh Up 443/tcp, 0.0.0.0:9099->80/tcp
deno-restful-api-with-postgresql-tdd_restful_1 deno run --allow-net --all ... Up 0.0.0.0:9000->8000/tcp ****
when I start my compose, I can access my pgadmin,and postgresq, but I can't access my service written by deno; plz ,help me to find the cause; at the same times, I can request my health API in docker container, /api/v1/health
thx
While using this image under GitLab CI I get tons of warnings:
...
WARNING: /usr/share/git-core/templates/hooks/update.sample: not supported: outside build directory
WARNING: /usr/share/git-core/templates/info: not supported: outside build directory
WARNING: /usr/share/git-core/templates/info/exclude: not supported: outside build directory
WARNING: /usr/share/man: not supported: outside build directory
WARNING: /usr/share/misc: not supported: outside build directory
WARNING: /usr/share/perl5: not supported: outside build directory
WARNING: /usr/share/udhcpc: not supported: outside build directory
WARNING: /usr/share/udhcpc/default.script: not supported: outside build directory
WARNING: /var: not supported: outside build directory
WARNING: /var/cache: not supported: outside build directory
WARNING: /var/cache/apk: not supported: outside build directory
WARNING: /var/cache/misc: not supported: outside build directory
WARNING: /var/empty: not supported: outside build directory
WARNING: /var/git: not supported: outside build directory
WARNING: /var/lib: not supported: outside build directory
WARNING: /var/lib/apk: not supported: outside build directory
WARNING: /var/lib/misc: not supported: outside build directory
WARNING: /var/lib/udhcpd: not supported: outside build directory
WARNING: /var/local: not supported: outside build directory
WARNING: /var/lock: not supported: outside build directory
WARNING: /var/lock/subsys: not supported: outside build directory
WARNING: /var/log: not supported: outside build directory
WARNING: /var/mail: not supported: outside build directory
WARNING: /var/opt: not supported: outside build directory
WARNING: /var/run: not supported: outside build directory
WARNING: /var/spool: not supported: outside build directory
WARNING: /var/spool/cron: not supported: outside build directory
WARNING: /var/spool/cron/crontabs: not supported: outside build directory
WARNING: /var/spool/mail: not supported: outside build directory
WARNING: /var/tmp: not supported: outside build directory
/: found 63 matching files and directories
WARNING: Part of .git directory is on the list of files to archive
WARNING: This may introduce unexpected problems
Uploading cache.zip to https://storage.googleapis.com/gitlab-com-runners-cache/project/24543707/master
Cleaning up file based variables 00:01
Job succeeded
I understand those are just warnings, but usually they don't need to be there if the image could be tweaked.
Could it be because the base image is frolvlad/alpine-glibc
?
While the README
suggests to use docker run --init
, the bullet-proof approach would be to bundling tini
in the container itself, as stated in the docker best practices guides for the official images:
https://github.com/docker-library/official-images#init
Its binary is extremely tiny and should not cause any noticeable increase in the size of the docker image.
There is a script to do this update/autoroll. But I don't think it's been wired up:
https://github.com/denoland/deno_docker/blob/main/_update_deno.ts
Originally posted by @hayd in #146 (comment)
It'd be great if we can pass an arg for a deno version to install, and your dockr image would default to the latest version if one isn't specified, for example this is how i setup my deno dockerfiles to us an arg for the deno version:
// docker-compose.yml
...
server:
container_name: ...
build:
context: .
dockerfile: .docker/deno.dockerfile
args:
DENO_VERSION: 1.4.6 // <-- here
...
// .docker/deno.dockerfile
FROM debian:stable-slim
ARG DENO_VERSION # <-- here
RUN apt update -y \
&& apt clean \
&& apt install bash curl unzip -y
RUN curl -fsSL https://deno.land/x/install/install.sh | DENO_INSTALL=/usr/local sh -s v${DENO_VERSION} # <-- here
similar to denoland/rusty_v8#663
get the latest version, sed the current version to the next (perhaps there is a cleaner way? but mostly I sed), and create a PR. It doesn't need to be rolling, it can just create a new one for any new version (for simplicity).
Awaiting compatible binaries ("coming")
https://releases.llvm.org/download.html
This should allow no inline tables and hence a smaller binary.
##[warning]Unexpected input 'tags', valid inputs are ['entryPoint', 'args', 'name', 'username', 'password', 'registry', 'snapshot', 'dockerfile', 'workdir', 'buildargs', 'cache', 'tag_names', 'tag_semver']
Edit: maybe fixed by updating the action elgohr/Publish-Docker-Github-Action#84
I tried building the CentoOs docker file (from Feb 5, 2021) on Docker Hub:
https://github.com/hayd/deno-docker/blob/490c69578c4321006a10dc1a33150d945808740e/centos.dockerfile
However it fails at step 7 with the following error:
Step 7/10 : COPY ./_entry.sh /usr/local/bin/docker-entrypoint.sh
COPY failed: stat /var/lib/docker/tmp/docker-builder854232540/_entry.sh: no such file or directory
FROM docker.repo1.uhc.com/denoland/deno:1.13.0
RUN apt-get update && \
apt-get install -y \
apt-transport-https \
ca-certificates \
curl
Results in an error:
The repository 'http://security.debian.org/debian-security stable/updates Release' does not have a Release file.
Details:
=> ERROR [ 2/10] RUN apt-get update && apt-get install -y apt-transport-https ca-certificates curl 5.2s
------
> [ 2/10] RUN apt-get update && apt-get install -y apt-transport-https ca-certificates curl:
#5 0.333
#5 0.333 WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
#5 0.333
#5 0.581 Ign:1 http://security.debian.org/debian-security stable/updates InRelease
#5 0.585 Get:2 http://deb.debian.org/debian stable InRelease [113 kB]
#5 0.630 Err:3 http://security.debian.org/debian-security stable/updates Release
#5 0.630 404 Not Found [IP: 151.101.130.132 80]
#5 0.981 Get:4 http://deb.debian.org/debian stable-updates InRelease [36.8 kB]
#5 1.144 Get:5 http://deb.debian.org/debian stable/main amd64 Packages [8178 kB]
#5 4.298 Reading package lists...
#5 5.172 E: The repository 'http://security.debian.org/debian-security stable/updates Release' does not have a Release file.
------
executor failed running [/bin/sh -c apt-get update && apt-get install -y apt-transport-https ca-certificates curl]: exit code: 100
This just started happening this morning for me, multiple machines are encountering it. Last Friday it was working fine... I've seen some answers on SO for this issue, such as:
https://unix.stackexchange.com/a/371907/446793
Which are pretty old so I'm not sure what's going on. Perhaps the version of base images Deno is relying on needs to be updated? I'm not really sure.
> deno --version ~/P/deno.proto.01 1
deno 0.31.0
v8 8.1.108
typescript 3.7.2
My simple main.ts:
import { Application, Router } from "https://deno.land/x/oak/mod.ts";
const router = new Router();
router
.get("/", context => {
console.log('called /');
context.response.body = "Hello world!";
})
.get('/fetch', async context => {
console.log('called /fetch');
const res = await fetch('https://pokeapi.co/api/v2/pokemon/ditto/')
.then(res => res.json());
context.response.body = JSON.stringify(res);
});
const app = new Application();
app.use(router.routes());
app.use(router.allowedMethods());
console.log('started on 1993');
app.listen(`127.0.0.1:1993`);
My docker file:
FROM hayd/deno:alpine-0.31.0
EXPOSE 1993
WORKDIR /app
# Prefer not to run as root.
USER deno
# Cache the dependencies as a layer (this is re-run only when deps.ts is modified).
# Ideally this will download and compile _all_ external files used in main.ts.
COPY deps.ts /app
RUN deno fetch deps.ts
# These steps will be re-run upon each file change in your working directory:
ADD . /app
# Compile the main app so that it doesn't need to be compiled each startup/entry.
RUN deno fetch main.ts
ENTRYPOINT ["deno", "run", "--allow-net", "main.ts"]
I'm getting an error with the build command: docker build -t app .
COPY failed: stat /var/lib/docker/tmp/docker-builder197418302/deps.ts: no such file or directory
NOTE: I have no deps.ts file in my source directory
i cant seem to get the remote container vs code extension to allow me to use the integrated terminal as the "deno" user that the image provides. it says this when the container is run:
# cat /etc/passwd
root:x:0:0:root:/root:/bin/ash
bin:x:1:1:bin:/bin:/sbin/nologin
daemon:x:2:2:daemon:/sbin:/sbin/nologin
...
guest:x:405:100:guest:/dev/null:/sbin/nologin
nobody:x:65534:65534:nobody:/:/sbin/nologin
deno:x:1993:1993:Linux User,,,:/home/deno:/sbin/nologin
Dockerfile
:
FROM hayd/alpine-deno:1.9.2
RUN apk --update add python3 git smartmontools tzdata && \
apk add snapraid --update-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing --allow-untrusted && \
rm -rf /var/cache/apk/*
COPY .devcontainer/config/snapraid.conf /etc
EXPOSE 8080
WORKDIR /app
USER deno
COPY deps.ts .
RUN deno cache deps.ts
ADD src ./src
RUN deno cache src/server.ts
devcontainer.json
:
{
"name": "snapraid-api",
"dockerFile": "Dockerfile",
"context": "..",
"settings": {
"terminal.integrated.defaultProfile.linux": "/bin/sh"
},
"extensions": ["denoland.vscode-deno"],
"forwardPorts": [8080],
"remoteUser": "deno"
}
i know that some of their example images have non root users, like node. commenting out USER deno
in the image and "remoteUser": "deno"
in the json config allows me to use the integrated terminal as root just fine. maybe someone familiar with the extension might spot what im doing wrong?
source of my .devcontainer
directory: https://github.com/kinghat/snapraid-gui/tree/0dc7e54815d68ef2f9abd8934ede9fcaca404714/apps/api/.devcontainer
adding the shadow
package and using chsh
to change the shell of deno
results in PAM auth error that might be related here: https://gitlab.alpinelinux.org/alpine/aports/-/issues/11025
See these warnings when installing deps to download on alpine:
Step 3/10 : RUN apk add --virtual .download --no-cache curl && curl -fsSL https://github.com/denoland/deno/releases/download/v${DENO_VERSION}/deno-x86_64-unknown-linux-gnu.zip --output deno.zip && unzip deno.zip && rm deno.zip && chmod 755 deno && mv deno /bin/deno && apk del .download
---> Running in cf53c461858a
fetch https://dl-cdn.alpinelinux.org/alpine/v3.13/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.13/community/x86_64/APKINDEX.tar.gz
(1/6) Installing ca-certificates (20191127-r5)
(2/6) Installing brotli-libs (1.0.9-r3)
(3/6) Installing nghttp2-libs (1.42.0-r1)
(4/6) Installing libcurl (7.76.1-r0)
(5/6) Installing curl (7.76.1-r0)
(6/6) Installing .download (20210513.204901)
Executing busybox-1.32.1-r6.trigger
Executing ca-certificates-20191127-r5.trigger
Executing glibc-bin-2.33-r0.trigger
/usr/glibc-compat/sbin/ldconfig: /usr/glibc-compat/lib/ld-linux-x86-64.so.2 is not a symbolic link
OK: 20 MiB in 23 packages
Archive: deno.zip
inflating: deno
WARNING: Ignoring https://dl-cdn.alpinelinux.org/alpine/v3.13/main: No such file or directory
WARNING: Ignoring https://dl-cdn.alpinelinux.org/alpine/v3.13/community: No such file or directory
(1/6) Purging .download (20210513.204901)
(2/6) Purging curl (7.76.1-r0)
(3/6) Purging libcurl (7.76.1-r0)
(4/6) Purging ca-certificates (20191127-r5)
Executing ca-certificates-20191127-r5.post-deinstall
(5/6) Purging brotli-libs (1.0.9-r3)
(6/6) Purging nghttp2-libs (1.42.0-r1)
Executing busybox-1.32.1-r6.trigger
Executing glibc-bin-2.33-r0.trigger
/usr/glibc-compat/sbin/ldconfig: /usr/glibc-compat/lib/ld-linux-x86-64.so.2 is not a symbolic link
OK: 17 MiB in 17 packages
Removing intermediate container cf53c461858a
---> c4e279e4ca10
With question in denoland/deno#1082 I believe it's worth noting in README proper way to use DENO_DIR
Namely DENO_DIR
should be volume mounted from host machine in order to leverage caching - otherwise on each run of container everything will be recompiled.
this is the .gitlab-ci.yml
file:
build:
image:
name: "hayd/debian-deno:latest"
script:
- echo hello
and gets the error:
Skipping Git submodules setup
Executing "step_script" stage of the job script
/bin/sh: 0: Can't open sh
If I add entrypoint like this:
build:
image:
name: "hayd/debian-deno:latest"
entrypoint: ["/bin/sh"]
script:
- echo hello
still gets another error:
Skipping Git submodules setup
Executing "step_script" stage of the job script
error: Found argument 'sh' which wasn't expected, or isn't valid in this context
USAGE:
deno [OPTIONS] [SUBCOMMAND]
For more information try --help
I think it should be a docker-entrypoint.sh
file, like node does.
This would allow using the image for launching other kind of scripts, and allowing Gitlab CI to work, for example.
I cant PR if you want. Cheers!
Docker image should have arm64
[4/6] RUN deno cache deps.ts:
#8 0.465 Download https://deno.land/[email protected]/http/server.ts
#8 1.724 Download https://deno.land/[email protected]/async/mod.ts
#8 1.724 Download https://deno.land/[email protected]/io/bufio.ts
#8 1.724 Download https://deno.land/[email protected]/_util/assert.ts
#8 1.725 Download https://deno.land/[email protected]/http/_io.ts
#8 1.725 Download https://deno.land/[email protected]/encoding/utf8.ts
#8 2.332 Download https://deno.land/[email protected]/async/delay.ts
#8 2.332 Download https://deno.land/[email protected]/async/deferred.ts
#8 2.332 Download https://deno.land/[email protected]/async/mux_async_iterator.ts
#8 2.333 Download https://deno.land/[email protected]/async/pool.ts
#8 2.592 Download https://deno.land/[email protected]/http/http_status.ts
#8 2.592 Download https://deno.land/[email protected]/textproto/mod.ts
#8 2.869 Download https://deno.land/[email protected]/bytes/mod.ts
#8 3.189 Check file:///app/deps.ts
#8 6.120 error: TS2416 [ERROR]: Property 'name' in type 'PartialReadError' is not assignable to the same property in base type 'UnexpectedEof'.
#8 6.120 Type 'string' is not assignable to type '"UnexpectedEof"'.
#8 6.120 name = "PartialReadError";
#8 6.120 ~~~~
#8 6.120 at https://deno.land/[email protected]/io/bufio.ts:27:3
executor failed running [/bin/sh -c deno cache deps.ts]: exit code: 1
When installing utilities to the global using deno install
they then can't be used in the image directly.
The image needs a
ENV PATH="${DENO_DIR}/bin:${PATH}"
somewhere in it.
Also, I noticed that deno install
doesn't install to DENO_DIR, it instead installs to /root/.deno/
which might be a separate issue.
Compiling file:///app/main.ts
Downloading https://deno.land/std/net/http.ts
thread 'tokio-runtime-worker-1' panicked at 'assertion failed: result.is_some()', ../../cli/compiler.rs:145:3
note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
Uncaught NotFound: Cannot resolve module "https://deno.land/std/net/http.ts" from "/app/main.ts"
at DenoError (deno/js/errors.ts:22:5)
at maybeError (deno/js/errors.ts:33:12)
at maybeThrowError (deno/js/errors.ts:39:15)
at sendSync (deno/js/dispatch.ts:82:5)
at fetchModuleMetaData (deno/js/os.ts:75:19)
at _resolveModule (deno/js/compiler.ts:249:38)
at resolveModuleNames (deno/js/compiler.ts:479:35)
at compilerHost.resolveModuleNames (deno/third_party/node_modules/typescript/lib/typescript.js:118650:138)
at resolveModuleNamesWorker (deno/third_party/node_modules/typescript/lib/typescript.js:86767:127)
at resolveModuleNamesReusingOldState (deno/third_party/node_modules/typescript/lib/typescript.js:87001:24)thread '
tokio-runtime-worker-0' panicked at 'called `Result::unwrap()` on an `Err` value: Canceled', src/libcore/result.rs:997:5
Of course this isn't gospel, but i feel thee docker image could be simplified a lot. For example, what i use for my docker environments is:
// docker-compose.yml
socket:
...
build:
context: .
dockerfile: .docker/deno.dockerfile
args:
DENO_VERSION: 1.2.3
environment:
USE_DENON: "true"
ports:
- "1668:1668"
volumes:
- "./src/socket:/var/www/socket"
working_dir: /var/www/socket
networks:
- chatsterisk-app-network
// .docker/deno.dockerfile
FROM debian:stable-slim
ARG DENO_VERSION
RUN apt update -y \
&& apt clean \
&& apt install bash curl unzip -y
RUN curl -fsSL https://deno.land/x/install/install.sh | DENO_INSTALL=/usr/local sh -s v${DENO_VERSION}
RUN export DENO_INSTALL="/root/.local"
RUN export PATH="$DENO_INSTALL/bin:$PATH"
COPY ./.docker/deno-entrypoint.sh /deno-entrypoint.sh
RUN chmod +x /deno-entrypoint.sh
ENTRYPOINT ["/deno-entrypoint.sh"]
// deno-entrypoint.sh
// just uses denon if USE_DENON env var is true
I think it'd be nice to see aspects of the above incorporated, for example the ARGS
, so from an end-user perspective, i'd do:
// docker-compose.yml
socket:
image: hayd/deno-image-name
environment:
DENO_VERSION: 1.5.6.7 # installs that specific version of deno
Whilst maybe still allow the user to specify an entrypoint, so for example i could still install denon and use denon
You have to first build gn using ubuntu then build deno with gn in alpine.
This should be possible, and I have some progress towards it... (failing) attempt: Dockerfile.
failure output
This may also be useful for automating creating of binaries suitable for AWS Lambda (or similar). The tricky part is to not rely on glibc... This is complete.
Note/Aside: Current size is 62Mb (18.1Mb compressed).
See also denoland/deno#1456 and https://dev.to/kt3k/write-aws-lambda-function-in-deno-4b20.
xpost: denoland/deno#3243
I tried to run it on raspberry 4 raspbian
Linux rpi4 5.4.72-v7l+ #1356 SMP Thu Oct 22 13:57:51 BST 2020 armv7l GNU/Linux
Looks like you use precompiled binary file.
Also, I tried to compile Deno on rpi and it failed right at the end of process with weird errors:
Compiling naga v0.3.2
error: failed to add native library /tmp/cargo-installmGoXAQ/release/gn_out/obj/librusty_v8.a: file too small to be an archive
error: aborting due to previous error
error: could not compile `rusty_v8`
To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: failed to add native library /tmp/cargo-installmGoXAQ/release/gn_out/obj/librusty_v8.a: file too small to be an archive
error: aborting due to previous error
error: failed to compile `deno v1.8.2`, intermediate artifacts can be found at `/tmp/cargo-installmGoXAQ`
I am not sure if this is a bug in this docker, in Gitlab, or me misunderstanding something. Please feel free to close if one of the two latter options.
I'm trying to use the Gitlab CI to build my project using Deno.
Running the CI gives me the following error:
error: Found argument 'sh' which wasn't expected, or isn't valid in this context
I get this for any deno
command that I run, including deno --version
.
This is my entire CI file:
image: hayd/deno
pages:
stage: deploy
script:
- deno --version
- deno run --unstable --allow-write --allow-read ./scripts/build.ts
artifacts:
paths:
- public
only:
- master
I get the error twice, once for deno --version
and once for deno run
.
I've tried different tags, but they all behave the same.
Note that using maxmcd/deno
, my pipeline works, but maxmcd
is stuck on 0.38
, so --unstable
doesn't work there (if I remove the need for --unstable
, the pipeline runs without problems).
Any idea what is going on?
Hey @hayd, i personally feel the dockerfile logic could be simplified, here is what I use for any deno container:
FROM debian:stable-slim
RUN apt update -y \
&& apt clean \
&& apt install bash curl unzip -y
RUN curl -fsSL https://deno.land/x/install/install.sh | DENO_INSTALL=/usr/local sh -s v1.5.1
RUN export DENO_INSTALL="/usr/bin"
RUN export PATH="$DENO_INSTALL/bin:$PATH"
I also wonder if it's worth adding ARGS
support for a deno version? eg:
// your dockerfile
ARG DENO_VERSION
Run install deno | v${DENO_VERSION}
// my docker-compose.yml file
deno:
args:
- DENO_VERSION: 1.4.5 # or whatever the syntax is i can't remember fully
Re-created #1. There already is deno v0.2.9
Hello @hayd 👋
I'm just looking at this project this week, and I have a couple of questions; since the Discussions feature isn't available in this repo, I'm opening this issue.
First, in the example Dockerfile:
It seems like lines 11–14 are not necessary since line 17 adds all files (including deps.ts
) and line 19 caches any dependencies imported by main.ts
(including deps.ts
if it even exists and is used). Am I overlooking something?
Second, I was wondering about the list of subcommands in the entrypoint file (line 5):
https://github.com/hayd/deno-docker/blob/b118b31a7b3afe860f83ff7e2de6607810f18f0d/_entry.sh#L1-L9
It seems that some of the deno subcommands available in deno --help
differ from what's in the list. I wrote a script to compare them and here are the results using deno v1.8.3
:
parse_subcommands_from_help.ts
:// deno --help | deno run parse_subcommands_from_help.ts <pipe-separated command list>
const parseError = new Error('Subcommands could not be parsed');
const parseLine = (line: string): [name: string, description: string] => {
const regex = /^\s*(?<name>[^\s]+)\s+(?<description>.+)$/u;
const {name, description} = line.trim().match(regex)?.groups ?? {};
if (!name || !description) throw parseError;
return [name, description];
};
export const parseSubcommands = (helpText: string): Record<string, string> => {
const lines = helpText.split('\n');
const startIndex = lines.findIndex(line => line.trim().toLowerCase() === 'subcommands:') + 1;
if (startIndex === 0) throw parseError;
const subcommands = {} as Record<string, string>;
for (let i = startIndex; i < lines.length - 1; i += 1) {
const line = lines[i];
if (!line.trim()) break;
const [name, description] = parseLine(line);
subcommands[name] = description;
}
return subcommands;
};
const compareSets = <T extends string | number>(setA: Set<T>, setB: Set<T>): {
a: T[];
b: T[];
common: T[];
same: boolean;
} => {
let same = setA.size === setB.size;
if (same) {
for (const val of setA) {
if (setB.has(val)) continue;
same = false;
break;
}
}
if (same) return {a: [], b: [], common: [...setA].sort(), same};
const common = [...setA].filter(val => setB.has(val)).sort();
const a = [...setA].filter(val => !setB.has(val)).sort();
const b = [...setB].filter(val => !setA.has(val)).sort();
return {a, b, common, same};
};
const joinListWithIndent = (list: string[], spaces = 2): string => {
return list.map(str => str.padStart(str.length + spaces, ' ')).join('\n');
};
const main = async (): Promise<void> => {
const arg = Deno.args[0] ?? '';
const inputList = new Set(arg.split('|')
.map(str => str.trim())
.filter(str => str.length));
if (inputList.size === 0) throw new Error('No input list provided');
const stdin = new TextDecoder().decode(await Deno.readAll(Deno.stdin));
const subcommands = parseSubcommands(stdin);
const helpList = new Set(Object.keys(subcommands));
const {a, b, common} = compareSets(inputList, helpList);
console.log(`common:\n${joinListWithIndent(common)}`);
console.log(`only in input list:\n${joinListWithIndent(a)}`);
console.log(`only in deno help:\n${joinListWithIndent(b)}`);
};
if (import.meta.main) main();
% deno --help | deno run parse_subcommands_from_help.ts "bundle | cache | completions | doc | eval | fmt | help | info | link | repl | run | test | types"
common:
bundle
cache
completions
doc
eval
fmt
help
info
repl
run
test
types
only in input list:
link
only in deno help:
compile
coverage
install
lint
lsp
upgrade
What does link
do? Also, are the other commands omitted intentionally or were they introduced after you last updated the file?
I'm slightly out of my depth here but I'll try my best to explain.
In the docs, it suggests usage of the deno
user over root
. This works fine when running my deno container locally, but when running on EC2, with the deno cli --allow-write
flag passed, I am unable to write to a mounted disk due to a permissions error:
PermissionDenied: Permission denied (os error 13)
Removing USER deno
from my Dockerfile (and falling back to root
) fixes this, but I wanted to understand if there are any particular reasons to be aware of, that I should not do this.
Thank you
Hi, I just tried to copy and run the example shown on https://hub.docker.com/r/hayd/alpine-deno/ but noticed it was different than the example shown on github readme.
Github:
docker run -it --init -p 1993:1993 -v $PWD:/app hayd/alpine-deno:1.0.0 run --allow-net /app/main.ts
Dockerhub (missing "run"):
docker run -it --init -p 1993:1993 -v $PWD:/app hayd/alpine-deno:1.0.0 --allow-net /app/main.ts
I don't think its intentional because the container fails to start with an error
Would you please note to fix? Thanks!
I'm seeing the following on a Linux host:
$ sudo docker run -it --init hayd/alpine-deno:1.8.0 eval 'console.log("Hello, world!");'
deno: /usr/lib/libstdc++.so.6: no version information available (required by deno)
deno: /usr/lib/libstdc++.so.6: no version information available (required by deno)
deno: /usr/lib/libstdc++.so.6: no version information available (required by deno)
deno: /usr/lib/libstdc++.so.6: no version information available (required by deno)
deno: /usr/lib/libstdc++.so.6: no version information available (required by deno)
Hello, world!
I know this is related to denoland/deno#9686 and that libstdc++ is installed manually to work around it, however, it seems the workaround is not working in my case for some reason.
Deno 1.0 is out today. It would be nice to have a published image:
hayd/alpine-deno:1.0.0
Hi there,
First of all thanks for providing this image, this is my go-to solution when using deno on docker 🙌
I was wondering if you could build and push a tag for version 1.7.5 of Deno? Currently the latest 1.7.* that exists is 1.7.2.
Let me know if I can help
Would be better to change DENO_DIR
to use deno
's user home instead of /deno-dir/
?
Eventually, this is not an issue with the image, but something I'm facing with GitLab CI (and probably some other solutions) that it complains about caching folders outside the build
(or user's home) sub-directory.
With Dockerfile:
FROM hayd/deno
EXPOSE 8080
WORKDIR /app
ADD . /app
CMD ["run", "--allow-net", "main.ts"]
main.ts
import { serve } from "https://deno.land/[email protected]/http/server.ts";
const s = serve({ port: 8080 });
console.log('listening :8080')
for await (const req of s) {
req.respond({ body: "Hello World\n" });
}
$ curl localhost:8080
curl: (52) Empty reply from server
Note the FROM hayd/deno
with FROM hayd/alpine-deno
it works just fine. That's what it says in the README too, so I'd be totally fine with a 'won't fix', just leaving this here for others that may like me naively use the unversioned image.
@hayd there already is deno v0.2.8, but deno used in this repo is just v0.2.6
Just spent a while headbutting weird CI failures. The ultimate solution was to rip apart and copy-paste alpine.dockerfile
, but with the pinned version of FROM frolvlad/alpine-glibc:alpine-3.13
. Because in this repo the dependency version is not pinned, newer images used 3.14
which caused weird edge case breakage in our build.
I'm not sure how this should be versioned. In our case, we want newer Deno but older Alpine. No specific recommendation here, just letting you know about the problem for now.
by default the created deno
in the alpine image inherits the roots shell, /bin/ash
. should this be explicitly set and changed to /bin/sh
? or install bash and /bin/bash
?
adduser --shell /bin/sh --disabled-password deno --ingroup deno
?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.