├── .bmp.yml ├── .dockerignore ├── .github └── workflows │ ├── ci.yml │ ├── set_docker_tags.yml │ └── version_bump.yml ├── LICENSE ├── README.md ├── _entry.sh ├── alpine.dockerfile ├── bin.dockerfile ├── debian.dockerfile ├── distroless.dockerfile ├── example ├── Dockerfile ├── README.md ├── deps.ts └── main.ts ├── tools └── release │ ├── create_pr.ts │ ├── deps.ts │ └── repo.ts └── ubuntu.dockerfile /.bmp.yml: -------------------------------------------------------------------------------- 1 | version: 2.3.5 2 | commit: '%.%.%' 3 | files: 4 | README.md: 5 | - 'denoland/deno:%.%.%' 6 | - 'denoland/deno:bin-%.%.%' 7 | alpine.dockerfile: ARG DENO_VERSION=%.%.% 8 | bin.dockerfile: ARG DENO_VERSION=%.%.% 9 | debian.dockerfile: ARG DENO_VERSION=%.%.% 10 | distroless.dockerfile: ARG DENO_VERSION=%.%.% 11 | example/Dockerfile: 'denoland/deno:%.%.%' 12 | ubuntu.dockerfile: ARG DENO_VERSION=%.%.% 13 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | * 2 | !_entry.sh 3 | !deno 4 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: ci 2 | 3 | on: 4 | # Run on any push to main or any tag 5 | push: 6 | branches: 7 | - main 8 | tags: 9 | - '*' 10 | # Run on any pull request 11 | pull_request: 12 | branches: 13 | - main 14 | 15 | jobs: 16 | build-bin: 17 | name: bin 18 | runs-on: ubuntu-latest 19 | steps: 20 | - name: Clone repository 21 | uses: actions/checkout@v4 22 | 23 | - name: Cache docker registry 24 | uses: actions/cache@v3 25 | with: 26 | key: registry-${{ github.sha }} 27 | path: ${{ runner.temp }}/registry 28 | 29 | - name: Cache Docker layers 30 | uses: actions/cache@v3 31 | with: 32 | path: /tmp/.buildx-cache 33 | # Key is named differently to avoid collision 34 | key: ${{ runner.os }}-multi-buildx-${{ github.sha }} 35 | restore-keys: | 36 | ${{ runner.os }}-multi-buildx 37 | 38 | - name: Start local Docker registry 39 | run: | 40 | # Docker save / load does not support multi-arch images. 41 | # This sets up a local registry that I can push the images to. 42 | docker run -d -p 5000:5000 -e 'REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY=/var/lib/registry' -v '${{ runner.temp }}/registry:/var/lib/registry' registry:2 43 | 44 | - name: Set up QEMU 45 | uses: docker/setup-qemu-action@v3 46 | 47 | - name: Set up Docker Buildx 48 | uses: docker/setup-buildx-action@v3 49 | with: 50 | driver-opts: network=host 51 | 52 | - name: Build image 53 | run: | 54 | docker buildx build -f bin.dockerfile --provenance=false --platform=linux/amd64,linux/arm64 -t localhost:5000/bin --push . 55 | 56 | build: 57 | needs: build-bin 58 | name: ${{ matrix.kind }} 59 | runs-on: ubuntu-latest 60 | strategy: 61 | matrix: 62 | kind: ["alpine", "debian", "distroless", "ubuntu"] 63 | steps: 64 | - name: Clone repository 65 | uses: actions/checkout@v4 66 | 67 | - name: Cache docker registry 68 | uses: actions/cache@v3 69 | with: 70 | key: registry-${{ github.sha }} 71 | fail-on-cache-miss: true 72 | path: ${{ runner.temp }}/registry 73 | 74 | - name: Cache Docker layers 75 | uses: actions/cache@v3 76 | with: 77 | path: /tmp/.buildx-cache 78 | # Key is named differently to avoid collision 79 | key: ${{ runner.os }}-multi-buildx-${{ github.sha }} 80 | restore-keys: | 81 | ${{ runner.os }}-multi-buildx 82 | 83 | - name: Start local Docker registry 84 | run: | 85 | # Docker save / load does not support multi-arch images. 86 | # This sets up a local registry that I can push the images to. 87 | docker run -d -p 5000:5000 -e 'REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY=/var/lib/registry' -v '${{ runner.temp }}/registry:/var/lib/registry' registry:2 88 | 89 | - name: Set up QEMU 90 | uses: docker/setup-qemu-action@v3 91 | 92 | - name: Set up Docker Buildx 93 | uses: docker/setup-buildx-action@v3 94 | with: 95 | driver-opts: network=host 96 | 97 | - name: Build image 98 | run: | 99 | docker buildx build -f ${{ matrix.kind }}.dockerfile --provenance=false --platform=linux/amd64,linux/arm64 --build-arg BIN_IMAGE=localhost:5000/bin -t localhost:5000/${{ matrix.kind }} --push . 100 | 101 | - name: Test default CMD 102 | run: | 103 | docker run -t localhost:5000/${{ matrix.kind }} 104 | 105 | - name: Test if entry script forwards to deno binary 106 | run: | 107 | docker run -t --platform linux/arm64 localhost:5000/${{ matrix.kind }} eval 'console.log(`Welcome to Deno ${Deno.build.arch}!`)' 108 | docker run -t --platform linux/amd64 localhost:5000/${{ matrix.kind }} eval 'console.log(`Welcome to Deno ${Deno.build.arch}!`)' 109 | 110 | # if typescript is present in the output, then probably deno --version worked 111 | docker run -t localhost:5000/${{ matrix.kind }} --version | grep typescript 112 | 113 | - name: Test if entry script forwards to other binaries 114 | if: ${{ matrix.kind != 'distroless' }} 115 | run: | 116 | docker run -t localhost:5000/${{ matrix.kind }} deno eval 'console.log(`Welcome to Deno ${Deno.build.arch}!`)' 117 | docker run -t localhost:5000/${{ matrix.kind }} echo 'test entry script' 118 | 119 | - name: Login to Docker Hub 120 | if: github.repository == 'denoland/deno_docker' && github.ref_type == 'tag' 121 | uses: docker/login-action@v3 122 | with: 123 | username: ${{ secrets.DOCKERHUB_USERNAME }} 124 | password: ${{ secrets.DOCKERHUB_PASSWORD }} 125 | 126 | - name: Push named images 127 | if: github.repository == 'denoland/deno_docker' && github.ref_type == 'tag' 128 | run: | 129 | docker buildx imagetools create localhost:5000/${{ matrix.kind }} -t denoland/deno:${{ matrix.kind }}-${{ github.ref_name }} -t denoland/deno:${{ matrix.kind }} 130 | docker pull --platform linux/amd64 denoland/deno:${{ matrix.kind }}-${{ github.ref_name }} 131 | docker pull --platform linux/amd64 denoland/deno:${{ matrix.kind }} 132 | docker pull --platform linux/arm64 denoland/deno:${{ matrix.kind }}-${{ github.ref_name }} 133 | docker pull --platform linux/arm64 denoland/deno:${{ matrix.kind }} 134 | 135 | - name: Push bin image 136 | if: github.repository == 'denoland/deno_docker' && github.ref_type == 'tag' && matrix.kind == 'debian' 137 | run: | 138 | docker buildx imagetools create localhost:5000/bin -t denoland/deno:bin-${{ github.ref_name }} -t denoland/deno:bin 139 | docker pull --platform linux/amd64 denoland/deno:bin-${{ github.ref_name }} 140 | docker pull --platform linux/amd64 denoland/deno:bin 141 | docker pull --platform linux/arm64 denoland/deno:bin-${{ github.ref_name }} 142 | docker pull --platform linux/arm64 denoland/deno:bin 143 | 144 | - name: Push default images 145 | if: github.repository == 'denoland/deno_docker' && github.ref_type == 'tag' && matrix.kind == 'debian' 146 | run: | 147 | docker buildx imagetools create localhost:5000/${{ matrix.kind }} -t denoland/deno:${{ github.ref_name }} -t denoland/deno:latest 148 | docker pull --platform linux/amd64 denoland/deno:${{ github.ref_name }} 149 | docker pull --platform linux/amd64 denoland/deno:latest 150 | docker pull --platform linux/arm64 denoland/deno:${{ github.ref_name }} 151 | docker pull --platform linux/arm64 denoland/deno:latest 152 | 153 | - name: Update Docker Hub Description 154 | if: github.repository == 'denoland/deno_docker' && github.ref_type == 'tag' && matrix.kind == 'debian' # Only on a tag and once per run (on debian run) 155 | uses: peter-evans/dockerhub-description@e98e4d1628a5f3be2be7c231e50981aee98723ae # v4.0.0 156 | with: 157 | username: ${{ secrets.DOCKERHUB_USERNAME }} 158 | password: ${{ secrets.DOCKERHUB_PASSWORD }} 159 | repository: denoland/deno 160 | short-description: ${{ github.event.repository.description }} 161 | -------------------------------------------------------------------------------- /.github/workflows/set_docker_tags.yml: -------------------------------------------------------------------------------- 1 | name: set_docker_tags 2 | on: 3 | workflow_dispatch: 4 | inputs: 5 | version: 6 | description: 'Enter version number to set the tags to.' 7 | type: string 8 | required: true 9 | 10 | jobs: 11 | set_tags: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - name: Set up Docker Buildx 15 | uses: docker/setup-buildx-action@v3 16 | with: 17 | driver-opts: network=host 18 | 19 | - name: Login to Docker Hub 20 | uses: docker/login-action@v3 21 | with: 22 | username: ${{ secrets.DOCKERHUB_USERNAME }} 23 | password: ${{ secrets.DOCKERHUB_PASSWORD }} 24 | 25 | - name: Check if source image exists 26 | run: | 27 | docker manifest inspect denoland/deno:${{ github.event.inputs.version }} > /dev/null 28 | 29 | - name: Set tags to version 30 | run: | 31 | docker buildx imagetools create -t denoland/deno:latest denoland/deno:${{github.event.inputs.version}} 32 | docker buildx imagetools create -t denoland/deno:debian denoland/deno:${{github.event.inputs.version}} 33 | docker buildx imagetools create -t denoland/deno:alpine denoland/deno:alpine-${{github.event.inputs.version}} 34 | docker buildx imagetools create -t denoland/deno:bin denoland/deno:bin-${{github.event.inputs.version}} 35 | docker buildx imagetools create -t denoland/deno:distroless denoland/deno:distroless-${{github.event.inputs.version}} 36 | docker buildx imagetools create -t denoland/deno:ubuntu denoland/deno:ubuntu-${{github.event.inputs.version}} 37 | -------------------------------------------------------------------------------- /.github/workflows/version_bump.yml: -------------------------------------------------------------------------------- 1 | name: version_bump 2 | permissions: 3 | contents: write 4 | on: 5 | workflow_dispatch: 6 | inputs: 7 | releaseKind: 8 | description: 'Kind of version upgrade. If you like to only change prerelease id, select "none"' 9 | default: 'patch' 10 | type: choice 11 | options: 12 | - patch 13 | - minor 14 | - major 15 | - none 16 | required: true 17 | prereleaseId: 18 | description: 'Prerelease id to append. If you don''t need append it, keep this blank' 19 | type: string 20 | 21 | jobs: 22 | build: 23 | name: version bump 24 | runs-on: ubuntu-latest 25 | timeout-minutes: 10 26 | 27 | steps: 28 | - name: Configure git 29 | run: | 30 | git config --global core.symlinks true 31 | git config --global fetch.parallel 32 32 | 33 | - name: Clone repository 34 | uses: actions/checkout@v3 35 | 36 | - name: Install deno 37 | uses: denoland/setup-deno@v1 38 | with: 39 | deno-version: canary 40 | 41 | - name: Run version bump 42 | run: | 43 | deno run --allow-read=. --allow-write=. jsr:@kt3k/bmp@0.2.3 --${{github.event.inputs.releaseKind}} 44 | if: github.event.inputs.releaseKind != 'none' 45 | 46 | - name: Append prerelease id if necessary 47 | run: | 48 | deno run --allow-read=. --allow-write=. jsr:@kt3k/bmp@0.2.3 --preid ${{github.event.inputs.prereleaseId}} 49 | if: github.event.inputs.prereleaseId 50 | 51 | - name: Create PR 52 | env: 53 | GITHUB_TOKEN: ${{ secrets.DENOBOT_PAT }} 54 | GH_WORKFLOW_ACTOR: ${{ github.actor }} 55 | run: | 56 | git config user.email "${{ github.actor }}@users.noreply.github.com" 57 | git config user.name "${{ github.actor }}" 58 | ./tools/release/create_pr.ts 59 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019-2021 Andy Hayden & the Deno authors 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # deno_docker 2 | 3 | Docker files for [Deno](https://github.com/denoland/deno) published on 4 | Dockerhub: 5 | 6 | - Alpine Linux: [denoland/deno:alpine](https://hub.docker.com/r/denoland/deno) 7 | - Debian: [denoland/deno:debian](https://hub.docker.com/r/denoland/deno) 8 | (default) 9 | - Distroless: [denoland/deno:distroless](https://hub.docker.com/r/denoland/deno) 10 | - Ubuntu: [denoland/deno:ubuntu](https://hub.docker.com/r/denoland/deno) 11 | - Only the binary: [denoland/deno:bin](https://hub.docker.com/r/denoland/deno) 12 | 13 | ![ci status](https://github.com/denoland/deno_docker/workflows/ci/badge.svg?branch=main) 14 | 15 | --- 16 | 17 | ## Run locally 18 | 19 | To start the `deno` repl: 20 | 21 | ```sh 22 | $ docker run -it denoland/deno:2.3.5 repl 23 | ``` 24 | 25 | To shell into the docker runtime: 26 | 27 | ```sh 28 | $ docker run -it denoland/deno:2.3.5 sh 29 | ``` 30 | 31 | To run `main.ts` from your working directory: 32 | 33 | ```sh 34 | $ docker run -it -p 1993:1993 -v $PWD:/app denoland/deno:2.3.5 run --allow-net /app/main.ts 35 | ``` 36 | 37 | Here, `-p 1993:1993` maps port 1993 on the container to 1993 on the host, 38 | `-v $PWD:/app` mounts the host working directory to `/app` on the container, and 39 | `--allow-net /app/main.ts` is passed to deno on the container. 40 | 41 | ## As a Dockerfile 42 | 43 | ```Dockerfile 44 | FROM denoland/deno:2.3.5 45 | 46 | # The port that your application listens to. 47 | EXPOSE 1993 48 | 49 | WORKDIR /app 50 | 51 | # Prefer not to run as root. 52 | USER deno 53 | 54 | # Cache the dependencies as a layer (the following two steps are re-run only when deps.ts is modified). 55 | # Ideally cache deps.ts will download and compile _all_ external files used in main.ts. 56 | COPY deps.ts . 57 | RUN deno install --entrypoint deps.ts 58 | 59 | # These steps will be re-run upon each file change in your working directory: 60 | COPY . . 61 | # Compile the main app so that it doesn't need to be compiled each startup/entry. 62 | RUN deno cache main.ts 63 | 64 | CMD ["run", "--allow-net", "main.ts"] 65 | ``` 66 | 67 | and build and run this locally: 68 | 69 | ```sh 70 | $ docker build -t app . && docker run -it -p 1993:1993 app 71 | ``` 72 | 73 | ## Using your own base image 74 | 75 | If you prefer to install `deno` in your own base image, you can use the 76 | `denoland/deno:bin` to simplify the process. 77 | 78 | ```Dockerfile 79 | FROM ubuntu 80 | COPY --from=denoland/deno:bin-2.3.5 /deno /usr/local/bin/deno 81 | ``` 82 | 83 | ## Running on Google Cloud Run(GCR) 84 | Due to conflicts with google cloud run caching mechanism it's required to use different path for `DENO_DIR` in your Dockerfile. 85 | 86 | ```Dockerfile 87 | # set DENO_DIR to avoid conflicts with google cloud 88 | ENV DENO_DIR=./.deno_cache 89 | ``` 90 | 91 | Without it GCR instance will try to download deps every time. When running with `--cached-only` you will get `Specified not found in cache`. 92 | 93 | ## (optional) Add `deno` alias to your shell 94 | 95 | Alternatively, you can add `deno` command to your shell init file (e.g. 96 | `.bashrc`): 97 | 98 | ```sh 99 | deno () { 100 | docker run \ 101 | --interactive \ 102 | --tty \ 103 | --rm \ 104 | --volume $PWD:/app \ 105 | --volume $HOME/.deno:/deno-dir \ 106 | --workdir /app \ 107 | denoland/deno:2.3.5 \ 108 | "$@" 109 | } 110 | ``` 111 | 112 | and in your terminal 113 | 114 | ```sh 115 | $ source ~/.bashrc 116 | $ deno --version 117 | $ deno run ./main.ts 118 | ``` 119 | 120 | --- 121 | 122 | See example directory. 123 | 124 | Note: Dockerfiles provide a USER `deno` and DENO_DIR is set to `/deno-dir/` 125 | (which can be overridden). 126 | 127 | _If running multiple Deno instances within the same image you can mount this 128 | directory as a shared volume._ 129 | 130 | ## Thanks 131 | 132 | Thanks to [Andy Hayden](https://github.com/hayd) for maintaining and setting up 133 | these images. 134 | -------------------------------------------------------------------------------- /_entry.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | if [ "$1" != "${1#-}" ]; then 5 | # if the first argument is an option like `--help` or `-h` 6 | exec deno "$@" 7 | fi 8 | 9 | case "$1" in 10 | add | bench | bundle | cache | compile | completions | coverage | doc | eval | fmt | help | init | info | install | jupyter | lint | lsp | publish | remove | repl | run | serve | task | test | types | uninstall | upgrade | vendor ) 11 | # if the first argument is a known deno command 12 | exec deno "$@";; 13 | esac 14 | 15 | exec "$@" 16 | -------------------------------------------------------------------------------- /alpine.dockerfile: -------------------------------------------------------------------------------- 1 | ARG DENO_VERSION=2.3.5 2 | ARG BIN_IMAGE=denoland/deno:bin-${DENO_VERSION} 3 | 4 | 5 | FROM ${BIN_IMAGE} AS bin 6 | 7 | 8 | FROM buildpack-deps:20.04-curl AS tini 9 | 10 | ARG TINI_VERSION=0.19.0 11 | ARG TARGETARCH 12 | 13 | RUN curl -fsSL https://github.com/krallin/tini/releases/download/v${TINI_VERSION}/tini-${TARGETARCH} \ 14 | --output /tini \ 15 | && chmod +x /tini 16 | 17 | FROM gcr.io/distroless/cc as cc 18 | 19 | FROM alpine:latest 20 | 21 | # Inspired by https://github.com/dojyorin/deno_docker_image/blob/master/src/alpine.dockerfile 22 | COPY --from=cc --chown=root:root --chmod=755 /lib/*-linux-gnu/* /usr/local/lib/ 23 | COPY --from=cc --chown=root:root --chmod=755 /lib/ld-linux-* /lib/ 24 | 25 | RUN addgroup --gid 1000 deno \ 26 | && adduser --uid 1000 --disabled-password deno --ingroup deno \ 27 | && mkdir /deno-dir/ \ 28 | && chown deno:deno /deno-dir/ \ 29 | && mkdir /lib64 \ 30 | && ln -s /usr/local/lib/ld-linux-* /lib64/ 31 | 32 | ENV LD_LIBRARY_PATH="/usr/local/lib" 33 | ENV DENO_DIR /deno-dir/ 34 | ENV DENO_INSTALL_ROOT /usr/local 35 | 36 | ARG DENO_VERSION 37 | ENV DENO_VERSION=${DENO_VERSION} 38 | COPY --from=bin /deno /bin/deno 39 | 40 | COPY --from=tini /tini /tini 41 | 42 | COPY ./_entry.sh /usr/local/bin/docker-entrypoint.sh 43 | RUN chmod 755 /usr/local/bin/docker-entrypoint.sh 44 | 45 | ENTRYPOINT ["/tini", "--", "docker-entrypoint.sh"] 46 | CMD ["eval", "console.log('Welcome to Deno!')"] 47 | -------------------------------------------------------------------------------- /bin.dockerfile: -------------------------------------------------------------------------------- 1 | ARG DENO_VERSION=2.3.5 2 | 3 | 4 | FROM buildpack-deps:20.04-curl AS download 5 | 6 | RUN export DEBIAN_FRONTEND=noninteractive \ 7 | && apt-get update \ 8 | && apt-get install -y unzip \ 9 | && rm -rf /var/lib/apt/lists/* 10 | 11 | ARG DENO_VERSION 12 | ARG TARGETARCH 13 | 14 | RUN curl -fsSL https://dl.deno.land/release/v${DENO_VERSION}/deno-$(echo $TARGETARCH | sed -e 's/arm64/aarch64/' -e 's/amd64/x86_64/')-unknown-linux-gnu.zip \ 15 | --output deno.zip \ 16 | && unzip deno.zip \ 17 | && rm deno.zip \ 18 | && chmod 755 deno 19 | 20 | 21 | FROM scratch 22 | 23 | ARG DENO_VERSION 24 | ENV DENO_VERSION=${DENO_VERSION} 25 | 26 | COPY --from=download /deno /deno 27 | -------------------------------------------------------------------------------- /debian.dockerfile: -------------------------------------------------------------------------------- 1 | ARG DENO_VERSION=2.3.5 2 | ARG BIN_IMAGE=denoland/deno:bin-${DENO_VERSION} 3 | 4 | 5 | FROM ${BIN_IMAGE} AS bin 6 | 7 | 8 | FROM buildpack-deps:20.04-curl AS tini 9 | 10 | ARG TINI_VERSION=0.19.0 11 | ARG TARGETARCH 12 | 13 | RUN curl -fsSL https://github.com/krallin/tini/releases/download/v${TINI_VERSION}/tini-${TARGETARCH} \ 14 | --output /tini \ 15 | && chmod +x /tini 16 | 17 | 18 | FROM debian:stable-slim 19 | 20 | RUN useradd --uid 1993 --user-group deno \ 21 | && mkdir /deno-dir/ \ 22 | && chown deno:deno /deno-dir/ 23 | 24 | ENV DENO_DIR /deno-dir/ 25 | ENV DENO_INSTALL_ROOT /usr/local 26 | 27 | ARG DENO_VERSION 28 | ENV DENO_VERSION=${DENO_VERSION} 29 | COPY --from=bin /deno /usr/bin/deno 30 | 31 | COPY --from=tini /tini /tini 32 | 33 | COPY ./_entry.sh /usr/local/bin/docker-entrypoint.sh 34 | RUN chmod 755 /usr/local/bin/docker-entrypoint.sh 35 | 36 | ENTRYPOINT ["/tini", "--", "docker-entrypoint.sh"] 37 | CMD ["eval", "console.log('Welcome to Deno!')"] 38 | -------------------------------------------------------------------------------- /distroless.dockerfile: -------------------------------------------------------------------------------- 1 | ARG DENO_VERSION=2.3.5 2 | ARG BIN_IMAGE=denoland/deno:bin-${DENO_VERSION} 3 | 4 | 5 | FROM ${BIN_IMAGE} AS bin 6 | 7 | 8 | FROM buildpack-deps:20.04-curl AS tini 9 | 10 | ARG TINI_VERSION=0.19.0 11 | ARG TARGETARCH 12 | 13 | RUN curl -fsSL https://github.com/krallin/tini/releases/download/v${TINI_VERSION}/tini-${TARGETARCH} \ 14 | --output /tini \ 15 | && chmod +x /tini 16 | 17 | 18 | FROM gcr.io/distroless/cc 19 | 20 | 21 | ENV DENO_DIR /deno-dir/ 22 | ENV DENO_INSTALL_ROOT /usr/local 23 | 24 | ARG DENO_VERSION 25 | ENV DENO_VERSION=${DENO_VERSION} 26 | COPY --from=bin /deno /bin/deno 27 | 28 | COPY --from=tini /tini /tini 29 | 30 | ENTRYPOINT ["/tini", "--", "/bin/deno"] 31 | CMD ["eval", "console.log('Welcome to Deno!')"] 32 | -------------------------------------------------------------------------------- /example/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM denoland/deno:2.3.5 2 | 3 | # The port that your application listens to. 4 | EXPOSE 1993 5 | 6 | WORKDIR /app 7 | 8 | # Prefer not to run as root. 9 | USER deno 10 | 11 | # Cache the dependencies as a layer (the following two steps are re-run only when deps.ts is modified). 12 | # Ideally cache deps.ts will download and compile _all_ external files used in main.ts. 13 | COPY deps.ts . 14 | RUN deno install --entrypoint deps.ts 15 | 16 | # These steps will be re-run upon each file change in your working directory: 17 | COPY . . 18 | # Compile the main app so that it doesn't need to be compiled each startup/entry. 19 | RUN deno cache main.ts 20 | 21 | CMD ["run", "--allow-net", "main.ts"] 22 | -------------------------------------------------------------------------------- /example/README.md: -------------------------------------------------------------------------------- 1 | The CMD line in the Dockerfile determines parameters passed to Deno. 2 | 3 | ``` 4 | CMD ["run", "--allow-net", "main.ts"] 5 | ``` 6 | 7 | Note: That the listen port (1993), must match with the EXPOSED port in the 8 | Dockerfile. 9 | 10 | Run using the build and run commands (you may want to use a more descriptive 11 | name than `app`): 12 | 13 | ```sh 14 | $ docker build -t app . && docker run -it --init -p 1993:1993 app 15 | ``` 16 | 17 | In another terminal or browser you can access: 18 | 19 | ```sh 20 | $ curl localhost:1993 21 | Hello World 22 | ``` 23 | -------------------------------------------------------------------------------- /example/deps.ts: -------------------------------------------------------------------------------- 1 | export { serve } from "https://deno.land/std@0.77.0/http/server.ts"; 2 | -------------------------------------------------------------------------------- /example/main.ts: -------------------------------------------------------------------------------- 1 | import { serve } from "./deps.ts"; 2 | 3 | const PORT = 1993; 4 | const s = serve(`0.0.0.0:${PORT}`); 5 | const body = new TextEncoder().encode("Hello World\n"); 6 | 7 | console.log(`Server started on port ${PORT}`); 8 | for await (const req of s) { 9 | req.respond({ body }); 10 | } 11 | -------------------------------------------------------------------------------- /tools/release/create_pr.ts: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env -S deno run -R -W -E -N -S --allow-run=git --no-check 2 | // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. 3 | import { createOctoKit, getGitHubRepository, parseYaml } from "./deps.ts"; 4 | import { loadRepo } from "./repo.ts"; 5 | 6 | const octoKit = createOctoKit(); 7 | const repo = await loadRepo(); 8 | const newVersion = parseYaml(await Deno.readTextFile(".bmp.yml")).version; 9 | 10 | const originalBranch = await repo.gitCurrentBranch(); 11 | const newBranchName = `release_${newVersion.replace(/\./, "_")}`; 12 | 13 | // Create and push branch 14 | console.log(`Creating branch ${newBranchName}...`); 15 | await repo.gitBranch(newBranchName); 16 | await repo.gitAdd(); 17 | await repo.gitCommit(newVersion); 18 | console.log("Pushing branch..."); 19 | await repo.gitPush("-u", "origin", "HEAD"); 20 | 21 | // Open PR 22 | console.log("Opening PR..."); 23 | const openedPr = await octoKit.request("POST /repos/{owner}/{repo}/pulls", { 24 | ...getGitHubRepository(), 25 | base: originalBranch, 26 | head: newBranchName, 27 | draft: true, 28 | title: newVersion, 29 | body: getPrBody(), 30 | }); 31 | console.log(`Opened PR at ${openedPr.data.url}`); 32 | 33 | function getPrBody() { 34 | let text = `Bumped version for ${newVersion}\n\n` + 35 | `Please ensure:\n` + 36 | `- [ ] Version in README.md is updated correctly\n` + 37 | `- [ ] Dockerfiles are updated correctly\n\n` + 38 | `To make edits to this PR:\n` + 39 | "```shell\n" + 40 | `git fetch upstream ${newBranchName} && git checkout -b ${newBranchName} upstream/${newBranchName}\n` + 41 | "```\n"; 42 | 43 | const actor = Deno.env.get("GH_WORKFLOW_ACTOR"); 44 | if (actor != null) { 45 | text += `\ncc @${actor}`; 46 | } 47 | 48 | return text; 49 | } 50 | -------------------------------------------------------------------------------- /tools/release/deps.ts: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. 2 | 3 | export * from "https://raw.githubusercontent.com/denoland/automation/0.20.0/mod.ts"; 4 | export * from "https://raw.githubusercontent.com/denoland/automation/0.20.0/github_actions.ts"; 5 | export { parse as parseYaml } from "jsr:@std/yaml@1"; 6 | export * as path from "jsr:@std/path@1"; 7 | -------------------------------------------------------------------------------- /tools/release/repo.ts: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. 2 | import { path, Repo } from "./deps.ts"; 3 | 4 | const currentDirPath = path.dirname(path.fromFileUrl(import.meta.url)); 5 | export const rootDirPath = path.resolve(currentDirPath, "../../"); 6 | 7 | export function loadRepo() { 8 | return Repo.load({ 9 | name: "deno_docker", 10 | path: rootDirPath, 11 | }); 12 | } 13 | -------------------------------------------------------------------------------- /ubuntu.dockerfile: -------------------------------------------------------------------------------- 1 | ARG DENO_VERSION=2.3.5 2 | ARG BIN_IMAGE=denoland/deno:bin-${DENO_VERSION} 3 | 4 | 5 | FROM ${BIN_IMAGE} AS bin 6 | 7 | 8 | FROM buildpack-deps:22.04-curl AS tini 9 | 10 | ARG TINI_VERSION=0.19.0 11 | ARG TARGETARCH 12 | 13 | RUN curl -fsSL https://github.com/krallin/tini/releases/download/v${TINI_VERSION}/tini-${TARGETARCH} \ 14 | --output /tini \ 15 | && chmod +x /tini 16 | 17 | 18 | FROM ubuntu:22.04 19 | 20 | RUN useradd --uid 1993 --user-group deno \ 21 | && mkdir /deno-dir/ \ 22 | && chown deno:deno /deno-dir/ 23 | 24 | ENV DENO_DIR /deno-dir/ 25 | ENV DENO_INSTALL_ROOT /usr/local 26 | 27 | ARG DENO_VERSION 28 | ENV DENO_VERSION=${DENO_VERSION} 29 | COPY --from=bin /deno /usr/bin/deno 30 | 31 | COPY --from=tini /tini /tini 32 | 33 | COPY ./_entry.sh /usr/local/bin/docker-entrypoint.sh 34 | RUN chmod 755 /usr/local/bin/docker-entrypoint.sh 35 | 36 | ENTRYPOINT ["/tini", "--", "docker-entrypoint.sh"] 37 | CMD ["eval", "console.log('Welcome to Deno!')"] 38 | --------------------------------------------------------------------------------