From 9e1cd03020a7f01a0630b6fd954b455abb1a763e Mon Sep 17 00:00:00 2001 From: zzq Date: Sun, 22 Sep 2024 12:11:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0yohe=E7=A7=81=E6=9C=89?= =?UTF-8?q?=E9=83=A8=E7=BD=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 ++ Dockerfile | 2 +- Makefile | 12 ++++++++++++ common.example.mk | 9 +++++++++ 4 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 .gitignore create mode 100644 Makefile create mode 100644 common.example.mk diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..32b138c --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +__pycache__ +common.mk \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 6a42a95..1eb9058 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,4 +14,4 @@ RUN pip install --no-cache-dir -r requirements.txt EXPOSE 8000 # 运行应用 -CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"] +CMD ["python", "app/main.py"] \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..0fc9880 --- /dev/null +++ b/Makefile @@ -0,0 +1,12 @@ +include common.mk + +.PHONY: build-image push-image + +build-image: + docker build --pull \ + -t="$(DOCKERHUB_ORGANIZATION)/$(DOCKERHUB_IMAGE):$(DOCKERHUB_TAG)" \ + -f Dockerfile . + +push-image: + docker login --username=$(DOCKERHUB_USERNAME) -p $(DOCKERHUB_PASSWORD) $(DOCKERHUB_REGISTRY) + docker push "$(DOCKERHUB_ORGANIZATION)/$(DOCKERHUB_IMAGE):$(DOCKERHUB_TAG)" diff --git a/common.example.mk b/common.example.mk new file mode 100644 index 0000000..e39cceb --- /dev/null +++ b/common.example.mk @@ -0,0 +1,9 @@ +COMMIT_ID = $(shell git rev-parse --short HEAD || echo "HEAD") + +DOCKERHUB_ORGANIZATION = registry.cn-shanghai.aliyuncs.com/muzimu +DOCKERHUB_IMAGE = yohe-ddddocr +DOCKERHUB_TAG = ${COMMIT_ID} + +DOCKERHUB_USERNAME = +DOCKERHUB_PASSWORD = +DOCKERHUB_REGISTRY = registry.cn-shanghai.aliyuncs.com