Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Dev Containers/Codespaces #1160

Merged
merged 5 commits into from
Mar 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#syntax=docker/dockerfile:1.6

FROM mcr.microsoft.com/vscode/devcontainers/python:3.12

RUN <<EOF
set -x
set -e
apt-get update
apt-get install -yq --no-install-recommends \
ffmpeg \
;
apt-get clean
rm -rf /var/lib/apt/lists/*
EOF
12 changes: 12 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"build": {
"dockerfile": "Dockerfile",
"context": ".."
},
"features": {
},
"postCreateCommand": "./.devcontainer/post-create.sh",
"forwardPorts": [
8095
]
}
13 changes: 13 additions & 0 deletions .devcontainer/post-create.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#! /usr/bin/env bash


if [ ! -d .venv ]
then
python -m venv .venv
fi

source .venv/bin/activate

pip install -e .[test]
pip install -r requirements_all.txt
robin-thoni marked this conversation as resolved.
Show resolved Hide resolved
pre-commit install
10 changes: 10 additions & 0 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@ Developer docs
It is recommended to use Visual Studio Code as your IDE, since launch files to start Music Assistant are provided as part of the repository. Furthermore, the current code base is not verified to work on a native Windows machine. If you would like to develop on a Windows machine, install [WSL2](https://code.visualstudio.com/blogs/2019/09/03/wsl2) to increase your swag-level 🤘.

## 🚀 Setting up your development environment

### Using Devcontainer/Codespace
* Using Codespace: Create/open your Codespace, and wait for the creation
* Using VSCode Dev Container locally: `Dev Containers: Open Folder in Container...`, select the root of the project, and wait for the creation
* Once VSCode has loaded, after a few seconds a terminal should pop with `Running postCreateCommand...`. Wait for the dependencies to install. You can monitor it with `Codespaces: View Creation Log`
* Select the right Python interpreter with `Python: Select Interpreter`, and choose `./.venv/bin/python`
* Hit (Fn +) F5 to start Music Assistant locally
* Go to the `PORTS` tab in the bottom panel, open the `Forwarded Address` for the port `8095` to access the pre-compiled UI of Music Assistant 🎉

### Manually
With this repository cloned locally, execute the following commands in a terminal from the root of your repository:
* `python -m venv .venv` (create a new separate virtual environment to nicely separate the project dependencies)
* `source .venv/bin/activate` (activate the virtual environment)
Expand Down
Loading