chore: install TagLib in devcontainer Dockerfile

Move TagLib installation from postCreateCommand script into the devcontainer Dockerfile to leverage Docker layer caching and simplify setup.\n\nChanges:\n- Install cross-taglib v2.1.1-1 directly in Dockerfile using TARGETARCH for multi-arch support (amd64/arm64).\n- Remove redundant libtag1-dev apt dependency; keep ffmpeg only.\n- Add CROSS_TAGLIB_VERSION as a build arg for consistency with CI/Makefile.\n- Remove postCreateCommand from devcontainer.json and delete install-taglib.sh script.\n\nWhy:\n- Avoid re-downloading TagLib on each container create; benefit from cached image layers.\n- Reduce redundancy and potential version mismatch between apt libtag and cross-taglib.\n- Keep devcontainer aligned with production build approach and CI settings.
This commit is contained in:
Deluan
2025-12-01 20:17:12 -05:00
parent cb38d2a031
commit 342b9eb2f2
3 changed files with 13 additions and 39 deletions

View File

@@ -9,12 +9,19 @@ ARG INSTALL_NODE="true"
ARG NODE_VERSION="lts/*"
RUN if [ "${INSTALL_NODE}" = "true" ]; then su vscode -c "source /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
# [Optional] Uncomment this section to install additional OS packages.
# Install additional OS packages
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
&& apt-get -y install --no-install-recommends libtag1-dev ffmpeg
&& apt-get -y install --no-install-recommends ffmpeg
# [Optional] Uncomment the next line to use go get to install anything else you need
# RUN go get -x <your-dependency-or-tool>
# Install TagLib from cross-taglib releases
ARG CROSS_TAGLIB_VERSION="2.1.1-1"
ARG TARGETARCH
RUN DOWNLOAD_ARCH="linux-${TARGETARCH}" \
&& wget -q "https://github.com/navidrome/cross-taglib/releases/download/v${CROSS_TAGLIB_VERSION}/taglib-${DOWNLOAD_ARCH}.tar.gz" -O /tmp/cross-taglib.tar.gz \
&& tar -xzf /tmp/cross-taglib.tar.gz -C /usr --strip-components=1 \
&& mv /usr/include/taglib/* /usr/include/ \
&& rmdir /usr/include/taglib \
&& rm /tmp/cross-taglib.tar.gz /usr/provenance.json
# [Optional] Uncomment this line to install global node packages.
# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1

View File

@@ -7,7 +7,8 @@
"VARIANT": "1.25",
// Options
"INSTALL_NODE": "true",
"NODE_VERSION": "v24"
"NODE_VERSION": "v24",
"CROSS_TAGLIB_VERSION": "2.1.1-1"
}
},
"workspaceMount": "",
@@ -54,9 +55,6 @@
4533,
4633
],
// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "make setup-dev",
"postCreateCommand": "bash .devcontainer/install-taglib.sh",
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode",
"remoteEnv": {

View File

@@ -1,31 +0,0 @@
#!/bin/bash
set -euo pipefail
# 1. Detect Architecture
ARCH=$(dpkg --print-architecture)
TAGLIB_VERSION="v2.1.1-1"
case $ARCH in
"amd64")
DOWNLOAD_ARCH="linux-amd64"
;;
"arm64")
DOWNLOAD_ARCH="linux-arm64"
;;
*)
echo "Unsupported architecture: $ARCH" >&2
exit 1
;;
esac
URL="https://github.com/navidrome/cross-taglib/releases/download/${TAGLIB_VERSION}/taglib-${DOWNLOAD_ARCH}.tar.gz"
echo "Downloading TagLib for ${ARCH} from ${URL}"
wget "$URL" -O /tmp/cross-taglib.tar.gz
sudo tar -xzf /tmp/cross-taglib.tar.gz -C /usr --strip-components=1
sudo mv /usr/include/taglib/* /usr/include/
sudo rmdir /usr/include/taglib
sudo rm /tmp/cross-taglib.tar.gz /usr/provenance.json
echo "TagLib installation complete"