Browse Source

Merge branch 'master' of http://git.cxhy.cn/yixue/yixue_gzh_dj

22285461@qq.com 3 months ago
parent
commit
23668162e3
2 changed files with 30 additions and 0 deletions
  1. 12 0
      Dockerfile
  2. 18 0
      docker-compose.yml

+ 12 - 0
Dockerfile

@@ -0,0 +1,12 @@
+
+# 第一个阶段:构建阶段
+FROM python:3.12-slim
+
+# 设置工作目录
+WORKDIR /app
+COPY . /app
+# 复制 requirements.txt 并运行 pip install 在单独的镜像层中
+RUN pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
+# RUN pip install --no-cache-dir -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
+
+# CMD ["gunicorn",  "-c", "gu_docker.py", "main.wsgi:application"]

+ 18 - 0
docker-compose.yml

@@ -0,0 +1,18 @@
+version: '3.8'
+
+services:
+ 
+  web:
+    build: .
+    command:  /bin/bash -c "python manage.py runserver"
+    # command:  /bin/bash -c "gunicorn -c gu_docker.py main.wsgi:application"
+    environment:
+      - DJANGO_ONLINE=1
+    volumes:
+      # - /data/logs:/data/logs
+      - /data/www/yixuedjango.cxhy.cn/code:/app
+      # - /data/www/cxAIServer:/data/www/cxAIServer
+    ports:
+      - "16003:80"
+    restart: unless-stopped
+