From 1c53a291fbda62c7cb6552a947ed27ab0a0fa01e Mon Sep 17 00:00:00 2001 From: DDSRem <1448139087@qq.com> Date: Fri, 11 Aug 2023 10:42:44 +0800 Subject: [PATCH] feat: frontend remote download --- .github/workflows/build-docker.yml | 34 ++++++++---------------------- Dockerfile | 8 +++++-- 2 files changed, 15 insertions(+), 27 deletions(-) diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index 0f622331..8d580ea3 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -9,7 +9,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@master + uses: actions/checkout@v3 - name: Docker meta id: meta @@ -24,49 +24,33 @@ jobs: app_version=$(cat version.py |sed -ne "s/APP_VERSION\s=\s'v\(.*\)'/\1/gp") echo "app_version=$app_version" >> $GITHUB_ENV - - - name: Setup node - uses: actions/setup-node@v3 - with: - node-version: '18' - - - - name: Build frontend - id: build_brontend - run: | - git clone https://github.com/jxxghp/MoviePilot-Frontend - cd MoviePilot-Frontend - yarn && yarn build - cd .. - mkdir -p public - cp -rf ./MoviePilot-Frontend/dist/* ./public/ - rm -rf MoviePilot-Frontend - chmod +x start.sh - - name: Set Up QEMU - uses: docker/setup-qemu-action@v1 + uses: docker/setup-qemu-action@v2 - name: Set Up Buildx - uses: docker/setup-buildx-action@v1 + uses: docker/setup-buildx-action@v2 - name: Login DockerHub - uses: docker/login-action@v1 + uses: docker/login-action@v2 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - name: Build Image - uses: docker/build-push-action@v2 + uses: docker/build-push-action@v4 with: context: . - file: ./Dockerfile + file: Dockerfile platforms: | linux/amd64 + linux/arm64 push: true + build-args: | + MOVIEPILOT_FRONTEND_VERSION=${{ env.app_version }} tags: | ${{ secrets.DOCKER_USERNAME }}/moviepilot:latest ${{ secrets.DOCKER_USERNAME }}/moviepilot:${{ env.app_version }} diff --git a/Dockerfile b/Dockerfile index 2f82e98f..a7251815 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,5 @@ FROM python:3.10.11-slim +ARG MOVIEPILOT_FRONTEND_VERSION ENV LANG="C.UTF-8" \ HOME="/moviepilot" \ TERM="xterm" \ @@ -41,9 +42,10 @@ RUN apt-get update \ gosu \ bash \ wget \ - && mkdir -p /etc/nginx ${HOME} \ + curl \ + busybox \ && cp -f nginx.conf /etc/nginx/nginx.template.conf \ - && mv ./public / \ + && mkdir -p ${HOME} \ && groupadd -r moviepilot -g 911 \ && useradd -r moviepilot -g moviepilot -d ${HOME} -s /bin/bash -u 911 \ && pip install --upgrade pip \ @@ -54,6 +56,8 @@ RUN apt-get update \ && echo 'fs.inotify.max_user_watches=5242880' >> /etc/sysctl.conf \ && echo 'fs.inotify.max_user_instances=5242880' >> /etc/sysctl.conf \ && locale-gen zh_CN.UTF-8 \ + && curl -sL "https://github.com/jxxghp/MoviePilot-Frontend/releases/download/v${MOVIEPILOT_FRONTEND_VERSION}/dist.zip" | busybox unzip -d / - \ + && mv /dist /public \ && apt-get autoremove -y \ && apt-get clean -y \ && rm -rf \