File tree Expand file tree Collapse file tree 6 files changed +93
-0
lines changed
Expand file tree Collapse file tree 6 files changed +93
-0
lines changed Original file line number Diff line number Diff line change 1+ # Deno Cache
2+
3+ Setup the [ deno cache] ( https://jsr.io/@deno/cache-dir ) as a volume.
4+
5+ Intended for usage with the ` denoland/deno:debian ` docker image. Otherwise,
6+ will create a ` deno ` group with read-write permissions on the cache directory.
Original file line number Diff line number Diff line change 1+ {
2+ "id" : " deno-cache" ,
3+ "name" : " Deno cache setup" ,
4+ "version" : " 0.1.0" ,
5+ "containerEnv" : {
6+ "DENO_DIR" : " /deno-dir"
7+ },
8+ "options" : {
9+ "username" : {
10+ "description" : " Add the 'deno' group to the given non-root user. Defaults to the value of `remoteUser`." ,
11+ "default" : " automatic" ,
12+ "type" : " string"
13+ }
14+ },
15+ "mounts" : [
16+ {
17+ "source" : " deno-cache-${devcontainerId}" ,
18+ "target" : " /deno-dir" ,
19+ "type" : " volume"
20+ }
21+ ],
22+ "installsAfter" : [
23+ " ghcr.io/devcontainers/features/common-utils"
24+ ]
25+ }
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ set -e
4+
5+ GROUP=deno
6+
7+ echo " Creating cache directory: $DENO_DIR "
8+ mkdir --parents " $DENO_DIR "
9+
10+ echo " Creating user group: $GROUP "
11+ groupadd --force --key GID_MIN=1993 " $GROUP "
12+
13+ echo " Assigning group to cache directory..."
14+ chgrp --changes --recursive " $GROUP " " $DENO_DIR "
15+
16+ echo " Assigning permissions with sticky group..."
17+ chmod --changes --recursive 2775 " $DENO_DIR "
18+
19+ echo " Appending group ${GROUP@ Q} to user..."
20+ if [[ " $USERNAME " == " automatic" ]]; then
21+ usermod --append --groups " $GROUP " " $_REMOTE_USER "
22+ elif [[ -n " $USERNAME " && " $USERNAME " != " root" ]]; then
23+ usermod --append --groups " $GROUP " " $USERNAME "
24+ fi
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ set -e
4+
5+ source dev-container-features-test-lib
6+
7+ check " Group exists" getent group deno
8+ check " Directory /deno-dir exists" test -d " $DENO_DIR "
9+ check " Group is set" test " $( stat --printf=" %G" " $DENO_DIR " ) " == " deno"
10+ check " Permissions are set" test " $( stat --printf=" %a" " $DENO_DIR " ) " -eq 2775
11+ check " Remote user is in the deno group" bash -c " getent group deno | grep jsr"
12+ check " Run deno info" deno info " jsr:@deno/cache-dir"
13+
14+ reportResults
Original file line number Diff line number Diff line change 1+ {
2+ "denoland_deno__debian__custom_user" : {
3+ "image" : " denoland/deno:debian" ,
4+ "remoteUser" : " jsr" ,
5+ "features" : {
6+ "deno-cache" : {},
7+ "ghcr.io/devcontainers/features/common-utils:2" : {
8+ "username" : " jsr"
9+ }
10+ }
11+ }
12+ }
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ set -e
4+
5+ source dev-container-features-test-lib
6+
7+ check " Group exists" getent group deno
8+ check " Directory /deno-dir exists" test -d " $DENO_DIR "
9+ check " Group is set" test " $( stat --printf=" %G" " $DENO_DIR " ) " == " deno"
10+ check " Permissions are set" test " $( stat --printf=" %a" " $DENO_DIR " ) " -eq 2775
11+
12+ reportResults
You can’t perform that action at this time.
0 commit comments