mirror of
https://github.com/tcsenpai/swingmusic.git
synced 2025-06-06 03:05:35 +00:00
Containerize application with Docker (#116)
* add dockerfile * use latest tag instead of latest commit * Added docker instructions * define entrypoint * specify to cd into directory after git clone * include config flag
This commit is contained in:
parent
994711b887
commit
6e3404e66e
33
Dockerfile
Normal file
33
Dockerfile
Normal file
@ -0,0 +1,33 @@
|
||||
FROM node:latest AS CLIENT
|
||||
|
||||
RUN git clone https://github.com/geoffrey45/swing-client.git client
|
||||
|
||||
WORKDIR /client
|
||||
|
||||
RUN git checkout $(git describe --tags $(git rev-list --tags --max-count=1))
|
||||
|
||||
RUN yarn install
|
||||
|
||||
RUN yarn build
|
||||
|
||||
FROM python:latest
|
||||
|
||||
WORKDIR /app/swingmusic
|
||||
|
||||
COPY . .
|
||||
|
||||
COPY --from=CLIENT /client/dist/ client
|
||||
|
||||
EXPOSE 1970/tcp
|
||||
|
||||
VOLUME /music
|
||||
|
||||
VOLUME /config
|
||||
|
||||
RUN pip install poetry
|
||||
|
||||
RUN poetry config virtualenvs.create false
|
||||
|
||||
RUN poetry install
|
||||
|
||||
ENTRYPOINT ["poetry", "run", "python", "manage.py", "--host", "0.0.0.0", "--config", "/config"]
|
49
README.md
49
README.md
@ -51,6 +51,55 @@ swingmusic --host 0.0.0.0
|
||||
|
||||
The link to access the app will be printed on your terminal. Copy it and open it in your browser.
|
||||
|
||||
### Docker
|
||||
|
||||
You can run Swing in a Docker container. To do so, clone the repository and build the image:
|
||||
|
||||
git clone https://github.com/swing-opensource/swingmusic.git --depth 1
|
||||
cd swingmusic
|
||||
docker build . -t swingmusic
|
||||
|
||||
Then create the container. Here are some example snippets to help you get started creating a container.
|
||||
|
||||
#### docker-compose
|
||||
|
||||
```yaml
|
||||
---
|
||||
version: "3.8"
|
||||
services:
|
||||
swing:
|
||||
image: swingmusic
|
||||
container_name: swingmusic
|
||||
volumes:
|
||||
- /path/to/music:/music
|
||||
- /path/to/config:/config
|
||||
ports:
|
||||
- 1970:1970
|
||||
restart: unless-stopped
|
||||
```
|
||||
|
||||
#### docker cli
|
||||
|
||||
```bash
|
||||
docker run -d \
|
||||
--name=swingmusic \
|
||||
-p 1970:1970 \
|
||||
-v /path/to/music:/music \
|
||||
-v /path/to/config:/config \
|
||||
--restart unless-stopped \
|
||||
swingmusic
|
||||
```
|
||||
|
||||
#### Parameters
|
||||
|
||||
Container images are configured using parameters passed at runtime (such as those above). These parameters are separated by a colon and indicate `<external>:<internal>` respectively. For example, `-p 8080:80` would expose port `80` from inside the container to be accessible from the host's IP on port `8080` outside the container.
|
||||
|
||||
| Parameter | Function |
|
||||
| :----: | --- |
|
||||
| `-p 1970` | WebUI |
|
||||
| `-v /music` | Recommended directory to store your music collection. You can bind other folder if you wish. |
|
||||
| `-v /config` | Configuration files. |
|
||||
|
||||
### Development
|
||||
|
||||
This project is broken down into 2. The client and the server. The client comprises of the user interface code. This part is written in Typescript, Vue 3 and SCSS. To setup the client, checkout the [swing client repo ](https://github.com/geoffrey45/swing-client) on GitHub.
|
||||
|
Loading…
x
Reference in New Issue
Block a user