File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ brew "bash-completion@2"
2+ brew "direnv"
3+ brew "fd"
4+ brew "gcc"
5+ brew "gh"
6+ brew "git"
7+ brew "moreutils"
8+ brew "the_silver_searcher"
9+
10+ # TODO
11+ # -----------------------------------------------------------------------------
12+
13+ # - [ ] ripgrep
14+ # - [ ] fzf
15+ # - [ ] Install https://github.com/junegunn/fzf in devcontainer
16+ # - [ ] Install hooks in dotfiles repo
Load Diff Large diffs are not rendered by default.
Original file line number Diff line number Diff line change 11# Use the latest Debian release
22FROM mcr.microsoft.com/vscode/devcontainers/base:bullseye as base
33
4+ ENV HOMEBREW_INSTALL_FROM_API='true'
45ENV BREW_BIN='/home/linuxbrew/.linuxbrew/bin'
6+ ENV BREW_SBIN='/home/linuxbrew/.linuxbrew/sbin'
57ENV SYS_PATH='/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
6- ENV PATH="${BREW_BIN}:${SYS_PATH}"
8+ ENV PATH="${BREW_SBIN}:${ BREW_BIN}:${SYS_PATH}"
79
810COPY . /opt/devcontainer
911WORKDIR /opt/devcontainer
Original file line number Diff line number Diff line change 1+ #! /bin/sh -ex
2+
3+ # Fix Homebrew ownership
4+ # =============================================================================
5+
6+ # Allow the current user to make changes to Homebrew by changing ownership of
7+ # the `HOMEBREW_PREFIX` directory and its contents to the current user
8+
9+ if test -z " ${HOMEBREW_PREFIX:= } " ; then
10+ HOMEBREW_PREFIX=" /home/linuxbrew/.linuxbrew"
11+ fi
12+
13+ whoami=" $( whoami) "
14+
15+ sudo chown -R " ${whoami} " " ${HOMEBREW_PREFIX} "
Original file line number Diff line number Diff line change 11#! /bin/bash -e
22
3+ sudo npm update --global
4+
5+ # Install `shellcheck` and `shfmt` independently from Trunk to avoid VS Code
6+ # extension errors when editing shell scripts outside of a Trunk project or
7+ # before initializing Trunk.
8+
39npm install --global \
10+ shellcheck \
11+ shfmt \
412 trunk
Original file line number Diff line number Diff line change 1- #! /bin/sh -e
1+ #! /bin/sh -ex
22
33GH_RAW_URL=https://raw.githubusercontent.com
44INSTALL_SCRIPT=install.sh
55INSTALL_URL=" ${GH_RAW_URL} /Homebrew/install/HEAD/${INSTALL_SCRIPT} "
66
77# Signal to the Homebrew installer that we can run as root
8- touch /.dockerenv
8+ sudo touch /.dockerenv
99
1010tmp_dir=" $( mktemp -d) "
1111clean () { rm -rf " ${tmp_dir} " ; }
1212trap clean EXIT
1313
14- cd " ${tmp_dir} "
15- wget -q " ${INSTALL_URL} " -O " ${INSTALL_SCRIPT} "
16- chmod 755 " ${INSTALL_SCRIPT} "
17- NONINTERACTIVE=false
18- export NONINTERACTIVE
19- HOMEBREW_INSTALL_FROM_API=true
20- export HOMEBREW_INSTALL_FROM_API
21- " ./${INSTALL_SCRIPT} "
14+ # Run the installation in a subshell to allow us to snap back to the original
15+ # working directory on exit
16+ (
17+ cd " ${tmp_dir} "
18+ wget -q " ${INSTALL_URL} " -O " ${INSTALL_SCRIPT} "
19+ chmod 755 " ${INSTALL_SCRIPT} "
20+ NONINTERACTIVE=false
21+ export NONINTERACTIVE
22+ HOMEBREW_INSTALL_FROM_API=true
23+ export HOMEBREW_INSTALL_FROM_API
24+ " ./${INSTALL_SCRIPT} "
25+ )
2226
23- brew install \
24- bash-completion@2 \
25- direnv \
26- gcc \
27- gh \
28- git
27+ # Get absolute path to script directory
28+ script_path=" $( realpath " ${0} " ) "
29+ script_dir=" $( dirname " ${script_path} " ) "
30+
31+ # Fix Homebrew owner
32+ " ${script_dir} /../fix-homebrew-owner.sh"
33+
34+ brew update
35+ brew bundle
36+ brew doctor
Original file line number Diff line number Diff line change 11#! /bin/sh -ex
22
3+ # Update content
4+ # ============================================================================
5+
36# Run whenever the contents of the workspace mount are updated
47# https://containers.dev/implementors/json_reference/#lifecycle-scripts
58
6- workspace_dir= " ${1 := } "
7-
9+ # Print help if no argument is provided
10+ workspace_dir= " ${1} "
811if test -z " ${workspace_dir} " ; then
912 echo " Usage: ${0} WORKSPACE_DIR" >&2
1013 exit 1
1114fi
1215
13- # Remove ACLs on files in the workspace mount so that the default system umask
14- # is respected
15- # https://github.com/orgs/community/discussions/26026#discussioncomment-3250078
1616whoami=" $( whoami) "
17+
18+ # Fix workspace umask
19+ # ----------------------------------------------------------------------------
20+
21+ # After applying the changes below, the current user's default umask will
22+ # be respected for all files in the workspace directory
23+
24+ # Change the ownership of the workspace directory and its contents to the
25+ # current user
1726sudo chown -R " ${whoami} " " ${workspace_dir} "
27+ # Remove all extended ACL entries (preserved by Docker during mount)
1828sudo setfacl -bnR " ${workspace_dir} "
1929
30+ # Fix Homebrew ownership
31+ # ----------------------------------------------------------------------------
32+
33+ ./fix-homebrew-owner.sh
34+
35+ # Allow direnv
36+ # ----------------------------------------------------------------------------
37+
2038# The `PATH` variable set in Dockerfile should be picked up when image is built
2139# and used as devcontainer (but it seems this is not the case)
2240echo " ${PATH} "
Original file line number Diff line number Diff line change 1414 - gitleaks@8.16.3
1515 - hadolint@2.12.0
1616 - prettier@2.8.8
17- - semgrep@1.20 .0
17+ - semgrep@1.21 .0
1818 - shellcheck@0.9.0
1919 - shfmt@3.5.0
2020 - yamllint@1.31.0
You can’t perform that action at this time.
0 commit comments