diff --git a/.travis.yml b/.travis.yml index 56130b7..8502d57 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,11 +12,9 @@ script: - set -e - echo "$DOCKER_PASSWORD" | docker login --username "$DOCKER_USERNAME" --password-stdin - docker-compose build deno -- docker-compose run deno ./out/Default/test_cc -- docker-compose run deno ./out/Default/deno_cc foo bar -- docker-compose run deno ./out/Default/deno_cc_nosnapshot foo bar -- docker-compose run deno ./out/Default/deno meow -- docker-compose run deno ./out/Default/deno_nosnapshot meow +- docker-compose build slim +- docker-compose push deno +- docker-compose push slim env: global: - secure: D9u/uHAJF1d25aD7clBEVDVgvtPH7MyETa4/YbWI9vm0d0Oh64aLPB97BRsdTf0SyuAZBMNhu0tI9E7tialElhKUmgcmFwFMCNLFtwLS9bC1AioiVCnkAL18ZYxjEu6nHkQyZrimyMSby23rquSZduCPEL9Tdl7x8hwahYwJt9ziCDhiqOLgqHDgcjfXaGsDpqWsGzFoQ6hZ47FPBG8a8DV8dpvyqcw1c5/AxuXN1ED+FVq8b8rCFATyFVU4L0PbhY3qWWV2hjKa1N8200Pb6zX+xepdjmiRsuvaGjAn1TblHTN5eIW1MCURdP7pIsvnIM064Okll9DmuGZIA265XDq0Apb7OPm8/lEJIdL2jWpQ8rEexjcuCgOr61PwqQEoLLTbGn+gPNj38WFMDNMDQ8OYtEzcykTRly5rIx6Af4OskLQbv8wmLFJyqeovhroxvZFmRPMpTTTBvw4HOhL4Ow3IiyLTG/+3OGrCSpgI5JxXmrudEEaP6eEx8krnvaw+IM11LX4JXjKuYk3Vum5msAHDdvOjO0CASs4XLAoJ9lRIIXTcda0rsDo0J6Rjeakjf6JzAFPo2tM9EDd+1LRaJD/tQIb8Fb31yWnG0gnsr6fGaUpvYyrNyQ0hHVnq49wlLoLwyUNy+UJpOOXy6+iVOepTST0BpTkHpV3NCWIB2Es= diff --git a/Dockerfile b/Dockerfile index 48b5f82..a496353 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,7 @@ FROM maxmcd/deno:_build-cache RUN git pull origin master -RUN ./tools/build_third_party.py -RUN gn gen out/Default/ --args='is_debug=false use_allocator="none" cc_wrapper="ccache" use_custom_libcxx=false use_sysroot=false' RUN ccache -s -RUN ninja -C out/Default/ :all +RUN ./tools/build.py + diff --git a/README.md b/README.md index 76f10b4..4494848 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,4 @@ Docker images for [ry/deno](https://github.com/ry/deno) -This repo no longer containes images that can run Typescript. There is a `build-cache.Dockerfile` and a `Dockerfile` as references on how to build deno. As soon as deno is at the point where it can execute arbitrary Typescript again this repo will be updated. -If you're using this as a build reference ensure to check out the build details in deno's [.travis.yml](https://github.com/ry/deno/blob/master/.travis.yml). diff --git a/build-cache.Dockerfile b/build-cache.Dockerfile index a2a5e97..53291f9 100644 --- a/build-cache.Dockerfile +++ b/build-cache.Dockerfile @@ -1,5 +1,11 @@ FROM phusion/baseimage +# complete ccache setup +ENV PATH="/usr/lib/ccache/:$PATH" +ENV CCACHE_SLOPPINESS=time_macros +ENV CCACHE_CPP2=yes +ENV PATH=/root/.cargo/bin:$PATH + RUN apt-get update && apt-get install -y --no-install-recommends \ ca-certificates \ libgtk-3-dev \ @@ -10,27 +16,23 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential \ git \ && apt-get clean -y \ - && rm -rf /var/lib/apt/lists/* - -ENV PATH="/usr/lib/ccache/:$PATH" -RUN mkdir -p /root/.ccache/ && touch /root/.ccache/ccache.conf -ENV CCACHE_SLOPPINESS=time_macros -ENV CCACHE_CPP2=yes - -RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - \ + && rm -rf /var/lib/apt/lists/* \ + # set up ccache + && mkdir -p /root/.ccache/ && touch /root/.ccache/ccache.conf \ + # install nodejs + && curl -sL https://deb.nodesource.com/setup_10.x | bash - \ && apt-get update && apt-get install -y nodejs \ - && npm install -g yarn - -RUN curl -sSf https://sh.rustup.rs | sh -s -- -y -ENV PATH=/root/.cargo/bin:$PATH - -RUN cd /opt/ && git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git -ENV PATH=$PATH:/opt/depot_tools + && npm install -g yarn \ + # install rust + && curl -sSf https://sh.rustup.rs | sh -s -- -y \ + # deno + && cd /opt/ && git clone https://github.com/ry/deno.git \ + && cd deno && git submodule update --init --recursive \ + && ccache -s \ + && ./tools/setup.py \ + && ./tools/build.py + # Accepts ninja build args + # https://github.com/ninja-build/ninja/blob/ca041d88f4d610332aa48c801342edfafb622ccb/src/ninja.cc#L197-L220 -RUN cd /opt/ && git clone https://github.com/ry/deno.git WORKDIR /opt/deno -RUN ./tools/build_third_party.py -RUN gn gen out/Default/ --args='is_debug=false use_allocator="none" cc_wrapper="ccache" use_custom_libcxx=false use_sysroot=false' -RUN ccache -s -RUN ninja -C out/Default/ :all diff --git a/docker-compose.yml b/docker-compose.yml index 02a88f1..8462a14 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,4 +10,9 @@ services: build: context: . dockerfile: ./Dockerfile - image: maxmcd/deno:deno + image: maxmcd/deno:master + slim: + build: + context: . + dockerfile: ./slim.Dockerfile + image: maxmcd/deno:slim diff --git a/example/Dockerfile b/example/Dockerfile index c9ae15d..1ff2bcc 100644 --- a/example/Dockerfile +++ b/example/Dockerfile @@ -2,4 +2,4 @@ FROM maxmcd/deno:slim COPY . . -CMD deno main.ts +CMD deno ./main.ts diff --git a/example/main.ts b/example/main.ts index 2628e95..accefce 100644 --- a/example/main.ts +++ b/example/main.ts @@ -1,25 +1 @@ -import * as deno from "deno"; - - -deno.sub("echo", (ui8: Uint8Array) => { - const str = String.fromCharCode.apply(null, ui8); - console.log("Got message", str); -}); - -function str2ui8(str: string): Uint8Array { - const ui8 = new Uint8Array(str.length); - for (let i = 0; i < str.length; i++) { - ui8[i] = str.charCodeAt(i); - } - return ui8; -} - -console.log("Before deno.pub()"); -deno.pub("echo", str2ui8("hello")); -console.log("After deno.pub()"); - - -const data = deno.readFileSync("main.ts"); -const decoder = new TextDecoder("utf-8"); -const json = decoder.decode(data); -console.log(json); +console.log("Hello World"); diff --git a/slim.Dockerfile b/slim.Dockerfile new file mode 100644 index 0000000..1cfda05 --- /dev/null +++ b/slim.Dockerfile @@ -0,0 +1,7 @@ +FROM maxmcd/deno:master as deno_from_scratch +FROM debian:stretch-slim +RUN apt-get update && apt-get install -y --no-install-recommends \ + ca-certificates +WORKDIR /opt/ +COPY --from=deno_from_scratch /opt/deno/out/debug/deno /usr/local/bin/ +CMD ["deno"]