From 5020b4596285751e3d1e879721812db6157971ac Mon Sep 17 00:00:00 2001 From: kingmo888 <17401091+kingmo888@users.noreply.github.com> Date: Wed, 20 Mar 2024 10:31:49 +0800 Subject: [PATCH] 0320 --- .github/workflows/build.yml | 119 ++++++++++++++++++++++++++++++++ .gitignore | 4 +- rustdesk_server_api/settings.py | 2 +- version.py | 1 + 新建文本文档.txt | 4 -- 5 files changed, 124 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/build.yml create mode 100644 version.py delete mode 100644 新建文本文档.txt diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..9dd3442 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,119 @@ +name: RustDesk Web Api +on: + workflow_dispatch: + inputs: + docker_username: + description: 'docker user name' + required: true + default: '' + docker_password: + description: 'docker user password' + required: true + default: '' + +jobs: + alpine: + runs-on: ubuntu-latest + name: Build Docker Image (Alpine) + steps: + - + name: Checkout + uses: actions/checkout@v3 + + - + name: Release version + id: release_version + run: | + app_version=$(cat version.py |sed -ne "s/APP_VERSION\s=\s'v\(.*\)'/\1/gp") + echo "app_version=${app_version}" >> $GITHUB_ENV + + - name: Docker metadata + id: meta + uses: docker/metadata-action@v4 + with: + images: | + ${{ github.event.inputs.docker_username }}/rustdesk-api-server + tags: | + type=raw,value=${{ env.app_version }} + type=raw,value=latest + + - + name: Set Up QEMU + uses: docker/setup-qemu-action@v2 + + - + name: Set Up Buildx + uses: docker/setup-buildx-action@v2 + + - + name: Login DockerHub + uses: docker/login-action@v2 + with: + username: ${{ github.event.inputs.docker_username }} + password: ${{ github.event.inputs.docker_password }} + + - + name: Build Image + uses: docker/build-push-action@v4 + with: + context: docker + file: docker/Dockerfile + platforms: | + linux/amd64 + linux/arm64 + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + + debian: + runs-on: ubuntu-latest + name: Build Docker Image (Debian) + steps: + - + name: Checkout + uses: actions/checkout@v3 + + - + name: Release version + id: release_version + run: | + app_version=$(cat version.py |sed -ne "s/APP_VERSION\s=\s'v\(.*\)'/\1/gp") + echo "app_version=${app_version}-debian" >> $GITHUB_ENV + + - name: Docker metadata + id: meta + uses: docker/metadata-action@v4 + with: + images: | + ${{ github.event.inputs.docker_username }}/rustdesk-api-server + tags: | + type=raw,value=${{ env.app_version }} + type=raw,value=debian + + - + name: Set Up QEMU + uses: docker/setup-qemu-action@v2 + + - + name: Set Up Buildx + uses: docker/setup-buildx-action@v2 + + - + name: Login DockerHub + uses: docker/login-action@v2 + with: + username: ${{ github.event.inputs.docker_username }} + password: ${{ github.event.inputs.docker_password }} + + - + name: Build Image + uses: docker/build-push-action@v4 + with: + context: docker + file: docker/debian.Dockerfile + platforms: | + linux/amd64 + linux/arm64 + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file diff --git a/.gitignore b/.gitignore index 5167aa8..fea7e31 100644 --- a/.gitignore +++ b/.gitignore @@ -26,4 +26,6 @@ dist_py38 LICENSE.rst db/test_db.sqlite3 -job2en.py \ No newline at end of file +job2en.py + +新建文本文档.txt \ No newline at end of file diff --git a/rustdesk_server_api/settings.py b/rustdesk_server_api/settings.py index c92857e..d0429d4 100644 --- a/rustdesk_server_api/settings.py +++ b/rustdesk_server_api/settings.py @@ -32,7 +32,7 @@ DEFAULT_AUTO_FIELD = 'django.db.models.AutoField' ALLOWED_HOSTS = ["*"] AUTH_USER_MODEL = 'api.UserProfile' #AppName.自定义user -ALLOW_REGISTRATION = os.environ.get("ALLOW_REGISTRATION", "True") == "True" # 是否允许注册, True为允许,False为不允许 +ALLOW_REGISTRATION = os.environ.get("ALLOW_REGISTRATION", "True") or os.environ.get("ALLOW_REGISTRATION", "True") == "True" # 是否允许注册, True为允许,False为不允许 #==========数据库配置 开始===================== DATABASE_TYPE = os.environ.get("DATABASE_TYPE", 'SQLITE') diff --git a/version.py b/version.py new file mode 100644 index 0000000..ac4df1f --- /dev/null +++ b/version.py @@ -0,0 +1 @@ +APP_VERSION = 'v3.3.15' \ No newline at end of file diff --git a/新建文本文档.txt b/新建文本文档.txt deleted file mode 100644 index aa71711..0000000 --- a/新建文本文档.txt +++ /dev/null @@ -1,4 +0,0 @@ -python manage.py makemessages -l zh_Hans -i xlwt -i django -python manage.py makemessages -l en -i xlwt -i django - -python manage.py compilemessages --pythonpath E:\python_workspace\rustdesk-server-api-python\rustdesk_server_api_github\locale\zh_Hans\LC_MESSAGES \ No newline at end of file