This commit is contained in:
Artem Anufrij 2023-02-08 12:33:50 +01:00
commit 5f63b7143b
8 changed files with 154 additions and 0 deletions

2
.env.production.example Normal file
View File

@ -0,0 +1,2 @@
# YOU INSTANCE DOMAIN
DOMAIN=example.com

6
.gitignore vendored Normal file
View File

@ -0,0 +1,6 @@
/cache
/database
/music
/uploads
/videos
.env.production

54
README.md Normal file
View File

@ -0,0 +1,54 @@
# Setup your own WebPlay instance
## Requirements
For run WebPlay as a docker container you need:
* docker
* docker-compose
installed on your server/computer
## Clone this repository
* `git clone https://gitea.com/WebPlay/docker.git webplay`
Change into folder
* `cd webplay`
Run docker-compose build
* `docker-compose build`
### Important
Open `docker-compose.yml` file and edit following lines:
```
volumes:
- ./videos:/webplay/videos
- ./music:/webplay/music
- ./cache:/webplay/cache
- ./uploads:/webplay/uploads
```
as example:
```
volumes:
- /path/to/your/video/files:/webplay/videos
- /path/to/your/audio/files:/webplay/music
- /path/for/cache:/webplay/cache
- /path/for/manual/uploads:/webplay/uploads
```
Optional you can change the client port (8081 by default):
```
ports:
- 8081:80
```
Start your instance
* `docker-compose up` or `docker-compose up -d` for running WebPlay in background
Open your browser and navigate to WebPlay
* `http://YOURSERVERADRESS:8081`
That's it.
Have fun
## Support
Join our Matrix room: <a href="https://matrix.to/#/#WebPlay:matrix.anufrij.de">#WebPlay:matrix.anufrij.de</a>

17
client/Dockerfile Normal file
View File

@ -0,0 +1,17 @@
FROM node:lts-alpine as build-client
RUN echo "Build WebPlay Client"
RUN apk update
RUN apk add git
RUN git clone https://gitea.com/WebPlay/client.git && cd client
RUN sed -i '/"electron":/d' client/package.json
RUN sed -i '/"electron-builder":/d' client/package.json
RUN sed -i '/"express":/d' client/package.json
RUN cd client && npm install
RUN cd client && npm run build
FROM nginx:alpine
COPY --from=build-client /client/dist /usr/share/nginx/html
COPY ./nginx.conf /etc/nginx/conf.d/default.conf

20
client/nginx.conf Normal file
View File

@ -0,0 +1,20 @@
server {
listen 80;
root /usr/share/nginx/html;
client_max_body_size 2G;
location /.well-known {
resolver 127.0.0.11;
proxy_set_header Host $http_host;
proxy_pass http://server:31204/well-known;
}
location /api {
resolver 127.0.0.11;
proxy_set_header Host $http_host;
proxy_pass http://server:31204/api;
}
location /users {
resolver 127.0.0.11;
proxy_set_header Host $http_host;
proxy_pass http://server:31204/users;
}
}

41
docker-compose.yml Normal file
View File

@ -0,0 +1,41 @@
version: "3"
services:
database:
image: mongo:4.4
restart: always
volumes:
- ./database:/data/db
redis:
image: redis:alpine
restart: always
server:
build: server/.
image: artemanufrij/webplay-server:latest
restart: always
env_file: .env.production
working_dir: /server
command: bash -c "node ./server.js"
ports:
- "31204:31204"
volumes:
- ./videos:/webplay/videos
- ./music:/webplay/music
- ./cache:/webplay/cache
- ./uploads:/webplay/uploads
depends_on:
- database
- redis
links:
- redis
- database
client:
build: client/.
image: artemanufrij/webplay-client:latest
restart: always
ports:
- 8081:80
depends_on:
- server

6
docker-rebuild.sh Normal file
View File

@ -0,0 +1,6 @@
#/bin/sh
docker-compose build --no-cache
docker-compose down
docker-compose up -d
docker image prune -af
docker volume prune -f

8
server/Dockerfile Normal file
View File

@ -0,0 +1,8 @@
FROM node:lts
RUN echo "Build WebPlay Server"
RUN apt update
RUN apt install -y --no-install-recommends ffmpeg lame
RUN git clone https://gitea.com/WebPlay/server.git && cd server && npm install
WORKDIR /server