initial commit

This commit is contained in:
maurice
2025-10-25 14:30:39 +02:00
commit e99337652d
13 changed files with 205 additions and 0 deletions

6
README.md Normal file
View File

@@ -0,0 +1,6 @@
# PHP
When using VS Code, you need to set `Laravel: PHP path` to
```
/home/user/.config/herd-lite/bin/php
```
Else it won't work.

24
base.Containerfile Normal file
View File

@@ -0,0 +1,24 @@
FROM alpine:latest
RUN apk update && apk add --no-cache \
git openssh helix bash bash-completion go curl \
helix-tree-sitter-vendor
# tree-sitter-yaml, tree-sitter-caddy
RUN adduser -D -u 1000 -s /bin/bash user
# Compile host-spawn
COPY scripts/build-host-spawn.sh .
RUN chmod +x build-host-spawn.sh
RUN ./build-host-spawn.sh
# Allow Podman host access
RUN ln -s /usr/local/bin/spawn /usr/local/bin/podman
# Config files
COPY config/ /home/user/
RUN chown -R user:user /home/user
WORKDIR /home/user
VOLUME /home/user

18
build.sh Executable file
View File

@@ -0,0 +1,18 @@
#!/bin/sh
set -e
# Check if a name argument was provided
if [ -z "$1" ]; then
echo "Usage: $0 <name>"
exit 1
fi
containerfile="$1.Containerfile"
# Check if the containerfile exists
if [ ! -f "$containerfile" ]; then
echo "Error: Containerfile '$containerfile' not found."
exit 1
fi
podman build -t "devc-$1" -f $containerfile

1
config/.bashrc Normal file
View File

@@ -0,0 +1 @@
export COLORTERM=truecolor

View File

@@ -0,0 +1,4 @@
theme = "dark_plus"
[editor.file-picker]
hidden = false

View File

@@ -0,0 +1,69 @@
# C#
[language-server.omnisharp]
command = "/home/user/.omnisharp/OmniSharp"
args = [ "--languageserver" ]
# Rust
[language-server.rust-analyzer.config.check]
command = "clippy"
[[language]]
name = "rust"
formatter = { command = "rustfmt" }
# Deno
[[language]]
name = "javascript"
shebangs = ["deno"]
roots = ["deno.json", "deno.jsonc"]
file-types = ["js"]
language-servers = ["deno-lsp"]
auto-format = true
[[language]]
name = "typescript"
shebangs = ["deno"]
roots = ["deno.json", "deno.jsonc"]
file-types = ["ts"]
language-servers = ["deno-lsp"]
auto-format = true
[[language]]
name = "jsx"
shebangs = ["deno"]
roots = ["deno.json", "deno.jsonc"]
file-types = ["jsx"]
language-servers = ["deno-lsp"]
auto-format = true
[[language]]
name = "tsx"
shebangs = ["deno"]
roots = ["deno.json", "deno.jsonc"]
file-types = ["tsx"]
language-servers = ["deno-lsp"]
auto-format = true
[language-server.deno-lsp]
command = "deno"
args = ["lsp"]
environment = { NO_COLOR = "1" }
[language-server.deno-lsp.config.deno]
enable = true
## Uncomment to enable completion of unstable features of Deno
## unstable = true
## Uncomment to cache dependencies on save
## cacheOnSave = true
## Enable completion of importing from registries
## Enable completion of function calls
suggest = { completeFunctionCalls = false, imports = { hosts = { "https://deno.land" = true } } }
## suggest = { imports = { hosts = { "https://deno.land" = true, "https://crux.land" = true, "https://x.nest.land" = true } } }
## Uncomment to enable inlay hints
## inlayHints.parameterNames.enabled = "all"
## inlayHints.parameterTypes.enabled = true
## inlayHints.variableTypes.enabled = true
## inlayHints.propertyDeclarationTypes.enabled = true
## inlayHints.functionLikeReturnTypes.enabled = true
## inlayHints.enumMemberValues.enabled = true

30
enter.sh Executable file
View File

@@ -0,0 +1,30 @@
#!/bin/sh
# Check if a name argument was provided
if [ -z "$1" ]; then
echo "Usage: $0 <name>"
exit 1
fi
name="devc-$1"
command="/bin/bash"
# When container is not running or arguments are provided,
# recreate it.
if [ "$(podman container inspect "$name" -f {{.State.Running}} 2>&1)" != 'true' ]; then
echo "starting devcontainer..."
podman container rm -f -t 0 "$name" 1>/dev/null
podman run \
--security-opt label=disable \
--userns=keep-id \
--name $name \
-e HOST_HOME=$HOME \
-e SSH_AUTH_SOCK='/tmp/ssh.sock' \
-v /run/user/$UID/bus:/tmp/dbus.sock \
-v /run/user/$UID/keyring/ssh:/tmp/ssh.sock \
-v $HOME/Dev:/home/user/dev \
-v v-$name:/home/user:copy \
--rm -td $name
fi
podman exec --detach-keys "ctrl-@" -it "$name" ${command:-}

9
fullstack.Containerfile Normal file
View File

@@ -0,0 +1,9 @@
FROM localhost/devc-web-base
RUN apk add --no-cache \
dotnet9-sdk
COPY scripts/install-roslyn.sh /tmp/install-roslyn.sh
RUN chmod +x /tmp/install-roslyn.sh && /tmp/install-roslyn.sh
USER user

4
php.Containerfile Normal file
View File

@@ -0,0 +1,4 @@
FROM localhost/devc-web-base
USER user
RUN /bin/bash -c "$(curl -fsSL https://php.new/install/linux/8.4)"

6
rust.Containerfile Normal file
View File

@@ -0,0 +1,6 @@
FROM localhost/devc-base
RUN su -c "curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y" user
RUN su -c ". '/home/user/.cargo/env' && rustup component add rust-analyzer" user
USER user

View File

@@ -0,0 +1,18 @@
#!/bin/bash
mkdir /tmp/build
cd /tmp/build
git clone https://github.com/1player/host-spawn.git
cd host-spawn
chmod +x build.sh
./build.sh $(uname -m)
cd build
mv host-spawn* /usr/local/bin/host-spawn
rm -rf /tmp/build
cat << EOF > /usr/local/bin/spawn
#!/bin/bash
export DBUS_SESSION_BUS_ADDRESS='unix:path=/tmp/dbus.sock'
host-spawn -cwd "\${PWD/#\$HOME/\$HOST_HOME}" \
$([ "$(basename "\$0")" != "spawn" ] && echo "\$(basename "\$0")") "\$@"
EOF
chmod +x /usr/local/bin/spawn

View File

@@ -0,0 +1,9 @@
#!/bin/bash
version="v1.39.15-beta.60"
arch="linux-musl-x64"
link="https://github.com/OmniSharp/omnisharp-roslyn/releases/download/$version/omnisharp-$arch-net6.0.tar.gz"
wget -O /tmp/omnisharp.tar.gz $link
mkdir /home/user/.omnisharp
tar -zxf /tmp/omnisharp.tar.gz -C /home/user/.omnisharp/
chown -R user:user /home/user/.omnisharp

7
web-base.Containerfile Normal file
View File

@@ -0,0 +1,7 @@
FROM localhost/devc-base
RUN apk add --no-cache \
deno pnpm
RUN su -c "pnpm setup && . /home/user/.bashrc && pnpm i -g bash-language-server vscode-langservers-extracted dockerfile-language-server-nodejs \
typescript typescript-language-server" user