Browse Source

add docker

liuyuqi-dellpc 1 year ago
parent
commit
a8a450b8ef
5 changed files with 137 additions and 0 deletions
  1. 10 0
      README.md
  2. 27 0
      deploy/.dockerignore
  3. 25 0
      deploy/Dockerfile
  4. 54 0
      deploy/docker-compose.debug.yml
  5. 21 0
      deploy/docker-compose.yml

+ 10 - 0
README.md

@@ -2,3 +2,13 @@
 
 调查报告,问卷调查。
 
+## Develop
+
+```
+git clone https://git.yoqi.me/zhizhou/survey.yoqi.me.git
+
+```
+
+## License
+
+## Reference

+ 27 - 0
deploy/.dockerignore

@@ -0,0 +1,27 @@
+**/__pycache__
+**/.venv
+**/.classpath
+**/.dockerignore
+**/.env
+**/.git
+**/.gitignore
+**/.project
+**/.settings
+**/.toolstarget
+**/.vs
+**/.vscode
+**/*.*proj.user
+**/*.dbmdl
+**/*.jfm
+**/bin
+**/charts
+**/docker-compose*
+**/compose*
+**/Dockerfile*
+**/node_modules
+**/npm-debug.log
+**/obj
+**/secrets.dev.yaml
+**/values.dev.yaml
+LICENSE
+README.md

+ 25 - 0
deploy/Dockerfile

@@ -0,0 +1,25 @@
+# For more information, please refer to https://aka.ms/vscode-docker-python
+FROM python:3.10-slim
+
+EXPOSE 5002
+
+# Keeps Python from generating .pyc files in the container
+ENV PYTHONDONTWRITEBYTECODE=1
+
+# Turns off buffering for easier container logging
+ENV PYTHONUNBUFFERED=1
+
+# Install pip requirements
+COPY requirements.txt .
+RUN python -m pip install -r requirements.txt
+
+WORKDIR /app
+COPY . /app
+
+# Creates a non-root user with an explicit UID and adds permission to access the /app folder
+# For more info, please refer to https://aka.ms/vscode-docker-python-configure-containers
+RUN adduser -u 5678 --disabled-password --gecos "" appuser && chown -R appuser /app
+USER appuser
+
+# During debugging, this entry point will be overridden. For more information, please refer to https://aka.ms/vscode-docker-python-debug
+CMD ["gunicorn", "--bind", "0.0.0.0:5002", "a:app"]

+ 54 - 0
deploy/docker-compose.debug.yml

@@ -0,0 +1,54 @@
+version: '3.4'
+
+services:
+  php-server:
+    image: jianboy/syoqi:latest
+    build:
+      context: .
+      dockerfile: ./Dockerfile
+    command: [ "sh", "-c", "php -S " ]
+    ports:
+      - 8080:8080
+    volumes:
+      - .:/var/www/html
+    networks:
+      - default
+    depends_on:
+      - mysql
+      # - redis
+
+  mysql:
+    image: mysql:5.7
+    environment:
+      MYSQL_ROOT_PASSWORD: root
+      MYSQL_DATABASE: test
+      MYSQL_USER: root
+      MYSQL_PASSWORD: root
+    ports:
+      - 3306:3306
+    volumes:
+      - mysql:/var/lib/mysql
+    networks:
+      - default
+
+  redis:
+    image: redis:latest
+    ports:
+      - 6379:6379
+    volumes:
+      - redis:/data
+    networks:
+      - default
+
+networks:
+  default:
+    external:
+      name: syoqi
+
+volumes:
+  mysql:
+    external:
+      name: mysql
+  redis:
+    external:
+      name: redis

+ 21 - 0
deploy/docker-compose.yml

@@ -0,0 +1,21 @@
+version: '3.4'
+
+services:
+  php-server:
+    image: syoqi
+    build:
+      context: .
+      dockerfile: ./Dockerfile
+    ports:
+      - 5002:5002
+
+  mysql:
+    image: mysql:5.7
+    environment:
+      MYSQL_ROOT_PASSWORD: root
+      MYSQL_DATABASE: test
+      MYSQL_USER: root
+      MYSQL_PASSWORD: root
+    ports:
+      - 3306:3306
+  # redis: