Skip to content

Commit

Permalink
ci(devcontainer): use official debian base image
Browse files Browse the repository at this point in the history
  • Loading branch information
ferferga authored Oct 3, 2024
1 parent e0a7569 commit 33cc252
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 14 deletions.
35 changes: 35 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
FROM mcr.microsoft.com/devcontainers/base:debian

USER root
RUN rm -rf /bin/sh && ln -s /bin/bash /bin/sh

# Creates a helper for installing packages leaving no traces behind
RUN cat > "/usr/sbin/install_packages" <<-'EOF'
#!/bin/bash
set -e
set -u
export DEBIAN_FRONTEND=noninteractive
n=0
max=2
until [ $n -gt $max ]; do
set +e
(
apt update -qq &&
apt install -y --no-install-recommends "$@"
)
CODE=$?
set -e
if [ $CODE -eq 0 ]; then
break
fi
if [ $n -eq $max ]; then
exit $CODE
fi
echo "apt failed, retrying"
n=$(($n + 1))
done
rm -r /var/lib/apt/lists /var/cache/apt/archives
EOF && chmod 0755 "/usr/sbin/install_packages"

# Installs Node.js
RUN curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo bash && install_packages nodejs
15 changes: 7 additions & 8 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
{
"name": "jellyfin-vue Codespace (with support for Tauri and Docker development)",
"image": "node:20-slim",
"build": {
"dockerfile": "Dockerfile"
},
"features": {
"ghcr.io/devcontainers/features/rust:1": {
"profile": "default"
},
"ghcr.io/devcontainers/features/docker-in-docker:2": {
"installDockerComposeSwitch": false
},
"ghcr.io/eitsupi/devcontainer-features/jq-likes:2": {},
"ghcr.io/devcontainers/features/github-cli:1": {}
},
"forwardPorts": [3000],
Expand All @@ -19,12 +20,10 @@
}
},
"postCreateCommand": {
"npm": "npm ci --no-audit",
"no-yarn": "unset YARN_VERSION && rm -rf /opt/yarn*",
"use-bash": "rm -rf /bin/sh && ln -s /bin/bash /bin/sh",
"git-config": "git config --global core.editor 'code --wait'",
"postunpack": ".devcontainer/postunpack.sh"
"postunpack": "install_packages $(cat packaging/tauri/apt_packages)"
},
"postAttachCommand": {
"install-extensions": "cat .vscode/extensions.json | jq -r .recommendations[] | xargs -n 1 code --install-extension"
},
"postAttachCommand": "cat .vscode/extensions.json | jq -r .recommendations[] | xargs -n 1 code --install-extension",
"hostRequirements": { "cpus": 4, "memory": "8gb" }
}
6 changes: 0 additions & 6 deletions .devcontainer/postunpack.sh

This file was deleted.

0 comments on commit 33cc252

Please sign in to comment.