Skip to content

Commit

Permalink
fix: template for nameko and apiflask
Browse files Browse the repository at this point in the history
  • Loading branch information
Bryanthelol committed Nov 29, 2023
1 parent 31a55f8 commit 5b01e58
Show file tree
Hide file tree
Showing 10 changed files with 56 additions and 150 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "pychassiscli"
version = "0.3.5"
version = "0.3.6"
description = "A lightweight Python distributed microservice command line tool"
authors = [
{ name = "BryantHe", email = "bryantsisu@qq.com" },
Expand Down
9 changes: 8 additions & 1 deletion src/pychassiscli/templates/apiflask/.dockerignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
.venv
venv/
venv/
local*
*.env
*.venv
env/
ENV/
env.bak/
venv.bak/
13 changes: 7 additions & 6 deletions src/pychassiscli/templates/apiflask/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
FROM python:3.11
FROM python:3.11-slim

RUN python3 -m pip uninstall -y pychassislib
# 拷贝依赖
COPY requirements.txt .
COPY . /app
# 设置工作路径
WORKDIR /app
# 安装依赖
RUN python3 -m pip install -i https://mirrors.cloud.tencent.com/pypi/simple --trusted-host=mirrors.cloud.tencent.com pdm>=2.10.1
# RUN python3 -m pip install -i https://mirrors.cloud.tencent.com/pypi/simple --trusted-host=mirrors.cloud.tencent.com -r requirements.txt
RUN python3 -m pdm install
RUN python3 -m pip install -i https://mirrors.cloud.tencent.com/pypi/simple --trusted-host=mirrors.cloud.tencent.com -r requirements.txt
# 启动时运行命令
CMD ["sh", "docker-deploy.sh"]
8 changes: 8 additions & 0 deletions src/pychassiscli/templates/apiflask/docker-compose-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: "3.8"

services:
apiflask-api:
image: gitea.bearcatlog.com/bryant/apiflask-api:latest
build:
context: .
dockerfile: ./Dockerfile
27 changes: 27 additions & 0 deletions src/pychassiscli/templates/apiflask/docker-compose-run.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
version: "3.8"

services:
apiflask-api:
image: gitea.bearcatlog.com/bryant/apiflask-api:latest
env_file:
- .apiflaskenv
- .apiflask.env
ports:
- "5000:5000"
deploy:
mode: replicated
replicas: 6
update_config:
parallelism: 3
failure_action: rollback
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 3
window: 120s
networks:
- apiflask-api-network

networks:
apiflask-api-network:
driver: overlay
125 changes: 0 additions & 125 deletions src/pychassiscli/templates/apiflask/docker-compose.yml

This file was deleted.

11 changes: 0 additions & 11 deletions src/pychassiscli/templates/apiflask/pyproject.toml

This file was deleted.

1 change: 1 addition & 0 deletions src/pychassiscli/templates/apiflask/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pychassislib[nameko,apiflask,schema]
8 changes: 3 additions & 5 deletions src/pychassiscli/templates/nameko/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
FROM python:3.11
FROM python:3.11-slim

RUN python3 -m pip uninstall -y pychassislib
# 拷贝依赖
COPY . /app
# 设置工作路径
WORKDIR /app
# 安装依赖
RUN python3 -m pip install -i https://mirrors.cloud.tencent.com/pypi/simple --trusted-host=mirrors.cloud.tencent.com pdm>=2.10.1
RUN python3 -m pdm install
RUN python3 -m pip install -i https://mirrors.cloud.tencent.com/pypi/simple --trusted-host=mirrors.cloud.tencent.com -r requirements.txt
# 启动时运行命令
CMD ["sh", "docker-deploy.sh", "./body_record/config.yml", "body_record.body_record"]
CMD ["sh", "docker-deploy.sh", "./admin/config.yml", "admin.admin"]
2 changes: 1 addition & 1 deletion src/pychassiscli/templates/nameko/docker-compose-build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: "3"
version: "3.8"

services:
nameko-service:
Expand Down

0 comments on commit 5b01e58

Please sign in to comment.