diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index 192914e9..ce66aa08 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -18,6 +18,26 @@ jobs: app_version=$(cat version.py |sed -ne "s/APP_VERSION\s=\s'v\(.*\)'/\1/gp") echo "app_version=$app_version" >> $GITHUB_ENV + - + name: Build frontend + id: build_brontend + run: | + curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash - + curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - + echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list + apt update + apt-get install -y nodejs yarn + node -v + yarn --version + git clone https://github.com/jxxghp/MoviePilot-Frontend + cd MoviePilot-Frontend + yarn + yarn build + cd .. + mkdir -p public + cp -f ./MoviePilot-Frontend/dist/* ./public/ + rm -rf MoviePilot-Frontend + - name: Set Up QEMU uses: docker/setup-qemu-action@v1 diff --git a/Dockerfile b/Dockerfile index 16122712..0f2be4c0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,7 @@ ENV LANG="C.UTF-8" \ PUID=0 \ PGID=0 \ UMASK=000 \ - WORKDIR="/MoviePilot" \ + WORKDIR="/app" \ CONFIG_DIR="/config" \ API_TOKEN="moviepilot" \ SUPERUSER="admin" \ @@ -35,7 +35,8 @@ ENV LANG="C.UTF-8" \ WORKDIR ${WORKDIR} COPY . . RUN apt-get update \ - && apt-get -y install musl-dev \ + && apt-get -y install musl-dev nginx \ + && cp -f nginx.conf /etc/nginx/nginx.conf \ && pip install -r requirements.txt \ && python_ver=$(python3 -V | awk '{print $2}') \ && echo "${WORKDIR}/" > /usr/local/lib/python${python_ver%.*}/site-packages/app.pth \ @@ -45,4 +46,4 @@ RUN apt-get update \ && rm -rf /root/.cache/ EXPOSE 3001 VOLUME ["/config"] -ENTRYPOINT [ "sh", "/MoviePilot/start.sh" ] +ENTRYPOINT [ "bash", "-c", "/app/start.sh & nginx -g 'daemon off;'" ] diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 00000000..b1f35781 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,18 @@ +events {} + +http { + server { + listen 3000; + server_name moviepilot; + + location / { + root /app/public; + index index.html; + try_files $uri $uri/ /index.html; + } + + location /docs { + proxy_pass http://localhost:3001; + } + } +}