Skip to content

Commit

Permalink
devcontainer install working
Browse files Browse the repository at this point in the history
  • Loading branch information
mtaron committed Apr 25, 2024
1 parent 7b2da01 commit e9ffc12
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 34 deletions.
39 changes: 39 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
FROM docker.io/ubuntu:jammy

RUN DEBIAN_FRONTEND=noninteractive apt-get update --yes \
&& apt-get upgrade --yes \
&& apt-get install --yes --no-install-recommends \
ca-certificates \
curl \
dialog \
git \
gnupg2 \
init-system-helpers \
less \
locales \
openssh-client \
sudo \
tzdata \
unzip \
xclip \
zip \
zsh \
&& yes | unminimize 2>&1 \
&& rm --recursive --force /var/lib/apt/lists/* \
&& locale-gen "en_US.UTF-8" \
&& dpkg-reconfigure locales

ARG USERNAME=dev
ARG USER_UID=1000
ARG USER_GID=$USER_UID

# Create a non-root user
RUN groupadd --gid $USER_GID $USERNAME \
&& useradd --shell /usr/bin/zsh --uid $USER_UID --gid $USERNAME --create-home $USERNAME \
# Add sudo support
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
&& chmod 0440 /etc/sudoers.d/$USERNAME

USER $USERNAME

CMD [ "sleep", "infinity" ]
5 changes: 4 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
{
"name": "Ubuntu",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/base:jammy"
"build":
{
"dockerfile": "Dockerfile"
}

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},
Expand Down
2 changes: 0 additions & 2 deletions external/vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
"azureFunctions.showProjectWarning": false,
"azureFunctions.showPythonVenvWarning": false,
"cfnLint.validateUsingJsonSchema": true,
"dotfiles.installCommand": "install.sh --one-shot",
"dotfiles.repository": "https://github.com/mtaron/dotfiles.git",
"dotfiles.targetPath": "~/dotfiles",
"editor.bracketPairColorization.enabled": true,
"editor.fontFamily": "'Monaspace Neon', monospace",
"editor.fontLigatures": "'calt', 'liga', 'dlig', 'ss01', 'ss02', 'ss03', 'ss04', 'ss06', 'ss07'",
Expand Down
36 changes: 6 additions & 30 deletions home/.chezmoi.yaml.tmpl
Original file line number Diff line number Diff line change
@@ -1,34 +1,14 @@
{{- /* environment/hardware tags */ -}}
{{- $devcontainer := false -}}{{/* devcontainer (codespaces, vscode) */}}
{{- $codespaces := false -}}{{/* github codespaces */}}
{{- $vscontainer := false -}}{{/* vs code remote containers */}}
{{- $isGnome := lookPath "gnome-shell" | not | not -}}
{{- $isGnome := lookPath "gnome-shell" | not | not -}}
{{- $isX := lookPath "xhost" | not | not -}}

{{- /* devcontainer detection */ -}}
{{- if (env "CODESPACES") -}}
{{- $codespaces = true -}}
{{- end -}}
{{- if (env "REMOTE_CONTAINERS_IPC") -}}
{{- $vscontainer = true -}}
{{- end -}}
{{- if or $codespaces $vscontainer -}}
{{- $devcontainer = true -}}
{{- end -}}

{{- /* boolean feature tags */ -}}
{{- $headless := false -}}{{/* no graphical interface */}}

{{- /* preset detection */ -}}
{{- if $devcontainer -}}
{{- $headless = true -}}
{{- end -}}
{{- $headless := true -}}

{{/* base configration */}}
{{- if and (not $headless) stdinIsATTY -}}
{{- if or $isGnome $isX -}}
{{- $headless = false -}}
{{- else if stdinIsATTY -}}
{{- $headless = promptBoolOnce . "headless" "headless" false -}}
{{- end -}}

{{- /* email configuration */ -}}
{{- $email := default "michael@taron.dev" (env "GIT_AUTHOR_EMAIL") -}}
{{- if stdinIsATTY -}}
{{ $email = promptStringOnce . "user.email" "email" $email }}
Expand All @@ -43,7 +23,3 @@ data:
email: {{ $email | quote }}
github: "mtaron"

devcontainer:
any: {{ $devcontainer }}
codespaces: {{ $codespaces }}
vscontainer: {{ $vscontainer }}
2 changes: 1 addition & 1 deletion home/.chezmoiscripts/linux/run_once_before_alacritty.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#!/usr/bin/env sh

# https://launchpad.net/~aslatter/+archive/ubuntu/ppa
sudo add-apt-repository --yes --ppa ppa:aslatter/ppa
sudo add-apt-repository --yes ppa:aslatter/ppa
sudo apt-get update --yes

sudo apt-get install --yes alacritty
Expand Down

0 comments on commit e9ffc12

Please sign in to comment.