diff --git a/Dockerfile b/Dockerfile index d219ebf..50a38fc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,9 +14,14 @@ ENV HOST 0.0.0.0 ENV TZ=Asia/Shanghai \ DEBIAN_FRONTEND=noninteractive +ENV CSRF_TRUSTED_ORIGINS="" + + EXPOSE 21114/tcp EXPOSE 21114/udp RUN cd /rustdesk-api-server -ENTRYPOINT ["bash", "run.sh"] \ No newline at end of file + +ENTRYPOINT ["bash", "run.sh"] + diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..2e64278 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,16 @@ +version: "3.8" +services: + rustdesk-api-server: + container_name: rustdesk-api-server + build: + context: . + environment: + - HOST=0.0.0.0 + - TZ=Asia/Shanghai + - CSRF_TRUSTED_ORIGINS= + volumes: + - ./db.sqlite3:/rustdesk-api-server/db.sqlite3 + - /etc/timezone:/etc/timezone:ro + - /etc/localtime:/etc/localtime:ro + ports: + - "21114:21114" diff --git a/run.sh b/run.sh new file mode 100644 index 0000000..e6f4efc --- /dev/null +++ b/run.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +cd /rustdesk-api-server; +python manage.py runserver $HOST:21114; diff --git a/rustdesk_server_api/settings.py b/rustdesk_server_api/settings.py index df310d3..ca0e852 100644 --- a/rustdesk_server_api/settings.py +++ b/rustdesk_server_api/settings.py @@ -14,7 +14,7 @@ from pathlib import Path # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = Path(__file__).resolve().parent.parent - +CSRF_TRUSTED_ORIGINS = [os.environ.get("CSRF_TRUSTED_ORIGINS", "None")] # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/ @@ -126,4 +126,4 @@ if DEBUG: else: - STATIC_ROOT = os.path.join(BASE_DIR, 'static') # 新增 \ No newline at end of file + STATIC_ROOT = os.path.join(BASE_DIR, 'static') # 新增