mirror of
https://github.com/owntone/owntone-server.git
synced 2025-11-07 21:03:00 -05:00
[dev] Add devcontainers and vscode config templates
This commit is contained in:
committed by
Alain Nussbaumer
parent
9fbd07a75d
commit
2fe6969f72
73
.dev/devcontainer/ubuntu/Dockerfile
Normal file
73
.dev/devcontainer/ubuntu/Dockerfile
Normal file
@@ -0,0 +1,73 @@
|
||||
FROM mcr.microsoft.com/devcontainers/base:ubuntu-24.04
|
||||
|
||||
ARG USERNAME=vscode
|
||||
|
||||
# Workaround for bug: https://github.com/devcontainers/images/issues/1056
|
||||
RUN userdel -r ubuntu; usermod -u 1000 $USERNAME; groupmod -g 1000 $USERNAME
|
||||
|
||||
RUN apt-get -y update \
|
||||
&& apt-get install -y \
|
||||
# Build tools and dependencies for OwnTone
|
||||
autoconf \
|
||||
automake \
|
||||
autotools-dev \
|
||||
bison \
|
||||
build-essential \
|
||||
flex \
|
||||
gawk \
|
||||
gettext \
|
||||
git \
|
||||
gperf \
|
||||
libasound2-dev \
|
||||
libavahi-client-dev \
|
||||
libavcodec-dev \
|
||||
libavfilter-dev \
|
||||
libavformat-dev \
|
||||
libavutil-dev \
|
||||
libconfuse-dev \
|
||||
libcurl4-openssl-dev \
|
||||
libevent-dev \
|
||||
libgcrypt20-dev \
|
||||
libjson-c-dev \
|
||||
libmxml-dev \
|
||||
libplist-dev \
|
||||
libprotobuf-c-dev \
|
||||
libsodium-dev \
|
||||
libsqlite3-dev \
|
||||
libswscale-dev \
|
||||
libtool \
|
||||
libunistring-dev \
|
||||
libwebsockets-dev \
|
||||
libxml2-dev \
|
||||
zlib1g-dev \
|
||||
# Build tools for mmkdocs (OwnTone documentation)
|
||||
python3-pip \
|
||||
# Additional runtime dependencies for dev container
|
||||
avahi-daemon \
|
||||
# Additional debug and devtools for dev container
|
||||
clang \
|
||||
clang-format \
|
||||
clang-tools \
|
||||
gdb \
|
||||
valgrind \
|
||||
# Additional terminal utility applications
|
||||
pipx \
|
||||
# bat - replacement for cat
|
||||
bat \
|
||||
# eza (https://eza.rocks/) - replacement for ls
|
||||
eza \
|
||||
# fuzzy search
|
||||
fzf \
|
||||
# Create folders and set ownership for folders that might be mounted as volumes
|
||||
&& mkdir -p /home/$USERNAME/.local/share \
|
||||
&& chown -R $USERNAME /home/$USERNAME/.local \
|
||||
&& mkdir /commandhistory \
|
||||
&& touch /commandhistory/.bash_history \
|
||||
&& chown -R $USERNAME /commandhistory \
|
||||
&& echo "export PROMPT_COMMAND='history -a' && export HISTFILE=/commandhistory/.bash_history" >> "/home/$USERNAME/.bashrc" \
|
||||
&& echo '[[ -f /scripts/init-devcontainer-cli.sh ]] && source /scripts/init-devcontainer-cli.sh' >> "/home/$USERNAME/.bashrc" \
|
||||
# Create folders for owntone-server data
|
||||
&& mkdir -p /data/logs /data/music /data/cache /data/conf \
|
||||
&& chown -R $USERNAME /data \
|
||||
# Clean up
|
||||
&& apt-get clean -y && rm -rf /var/lib/apt/lists/*
|
||||
55
.dev/devcontainer/ubuntu/devcontainer.json
Normal file
55
.dev/devcontainer/ubuntu/devcontainer.json
Normal file
@@ -0,0 +1,55 @@
|
||||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
|
||||
// README at: https://github.com/devcontainers/templates/tree/main/src/ubuntu
|
||||
{
|
||||
"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"
|
||||
},
|
||||
|
||||
"runArgs": [
|
||||
// Use host network to be able to connect to remote speakers
|
||||
"--network=host",
|
||||
"--env-file", ".devcontainer/devcontainer.env"
|
||||
],
|
||||
|
||||
// Configure tool-specific properties.
|
||||
"customizations": {
|
||||
"vscode": {
|
||||
"extensions": [
|
||||
"Vue.volar",
|
||||
"ms-vscode.cpptools-extension-pack",
|
||||
"ms-azuretools.vscode-docker",
|
||||
"lokalise.i18n-ally",
|
||||
"esbenp.prettier-vscode"
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
// Features to add to the dev container. More info: https://containers.dev/features.
|
||||
"features": {
|
||||
"ghcr.io/devcontainers/features/node:1": {}
|
||||
},
|
||||
|
||||
// Mounts volumes to keep files / state between container rebuilds
|
||||
"mounts": [
|
||||
// Map script folder to install and init additional tools (see "postCreateCommand" and Dockerfile / .bashrc)
|
||||
"source=${localWorkspaceFolder}/.devcontainer/.scripts,target=/scripts,type=bind,consistency=cached",
|
||||
// Persist ~/.bash_history
|
||||
"source=owntone-bashhistory,target=/commandhistory,type=volume",
|
||||
// Persist ~/.local/share to persist state of additionally installed tools (e. g. atuin, zoxide)
|
||||
"source=owntone-localshare,target=/home/vscode/.local/share,type=volume",
|
||||
// Bind mounts for owntone config file and logs, cache, music directories
|
||||
//"source=<path-to-local-logs-dir>,target=/data/logs,type=bind,consistency=cached",
|
||||
//"source=<path-to-local-cache-dir>,target=/data/cache,type=bind,consistency=cached",
|
||||
//"source=<path-to-local-music-dir>,target=/data/music,type=bind,consistency=cached",
|
||||
"source=${localWorkspaceFolder}/.devcontainer/data/devcontainer-owntone.conf,target=/data/conf/owntone.conf,type=bind,consistency=cached"
|
||||
],
|
||||
|
||||
// Use 'postCreateCommand' to run commands after the container is created.
|
||||
"postCreateCommand": "bash /scripts/install-devcontainer-tools.sh",
|
||||
|
||||
// Start dbus and avahi, required when running owntone-server
|
||||
"postStartCommand": "sudo service dbus start ; sudo avahi-daemon -D"
|
||||
}
|
||||
Reference in New Issue
Block a user