Skip to content

Commit 59a3529

Browse files
authored
ci(devcontainer): use official debian base image
1 parent e0a7569 commit 59a3529

File tree

3 files changed

+47
-14
lines changed

3 files changed

+47
-14
lines changed

.devcontainer/Dockerfile

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
FROM mcr.microsoft.com/devcontainers/base:debian
2+
3+
USER root
4+
RUN rm -rf /bin/sh && ln -s /bin/bash /bin/sh
5+
6+
# Create a helper for installing packages leaving no traces behind
7+
COPY <<EOF /usr/sbin/install_packages
8+
#!/bin/bash
9+
set -e
10+
set -u
11+
export DEBIAN_FRONTEND=noninteractive
12+
n=0
13+
max=2
14+
until [ \$n -gt \$max ]; do
15+
set +e
16+
(
17+
apt update -qq &&
18+
apt install -y --no-install-recommends "\$@"
19+
)
20+
CODE=\$?
21+
set -e
22+
if [ \$CODE -eq 0 ]; then
23+
break
24+
fi
25+
if [ \$n -eq \$max ]; then
26+
exit \$CODE
27+
fi
28+
echo "apt failed, retrying"
29+
n=\$((\$n + 1))
30+
done
31+
rm -rf /var/lib/apt/lists/{*,.*} /var/cache/apt/archives/{*,.*}
32+
EOF
33+
34+
# Set permissions and install node
35+
RUN chmod 0755 /usr/sbin/install_packages && \
36+
curl -fsSL https://deb.nodesource.com/setup_lts.x | bash && \
37+
install_packages nodejs

.devcontainer/devcontainer.json

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
{
22
"name": "jellyfin-vue Codespace (with support for Tauri and Docker development)",
3-
"image": "node:20-slim",
3+
"build": {
4+
"dockerfile": "Dockerfile"
5+
},
6+
"remoteUser": "root",
47
"features": {
58
"ghcr.io/devcontainers/features/rust:1": {
69
"profile": "default"
710
},
811
"ghcr.io/devcontainers/features/docker-in-docker:2": {
912
"installDockerComposeSwitch": false
1013
},
11-
"ghcr.io/eitsupi/devcontainer-features/jq-likes:2": {},
1214
"ghcr.io/devcontainers/features/github-cli:1": {}
1315
},
1416
"forwardPorts": [3000],
@@ -18,13 +20,13 @@
1820
"onAutoForward": "notify"
1921
}
2022
},
21-
"postCreateCommand": {
23+
"onCreateCommand": {
2224
"npm": "npm ci --no-audit",
23-
"no-yarn": "unset YARN_VERSION && rm -rf /opt/yarn*",
24-
"use-bash": "rm -rf /bin/sh && ln -s /bin/bash /bin/sh",
25-
"git-config": "git config --global core.editor 'code --wait'",
26-
"postunpack": ".devcontainer/postunpack.sh"
25+
"postunpack": "install_packages $(cat packaging/tauri/apt_packages)",
26+
"unshallow": "git fetch --unshallow"
27+
},
28+
"postAttachCommand": {
29+
"install-extensions": "cat .vscode/extensions.json | jq -r .recommendations[] | xargs -n 1 code --install-extension"
2730
},
28-
"postAttachCommand": "cat .vscode/extensions.json | jq -r .recommendations[] | xargs -n 1 code --install-extension",
2931
"hostRequirements": { "cpus": 4, "memory": "8gb" }
3032
}

.devcontainer/postunpack.sh

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)