国内镜像源
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
# 使用国内镜像源(DaoCloud 公益镜像)作为基础镜像
|
||||
FROM swr.cn-north-4.myhuaweicloud.com/ddn-k8s/docker.io/python:3.9-slim
|
||||
# 使用 DaoCloud 国内镜像代理加速下载 (支持多架构)
|
||||
# 接收构建参数 BASE_IMAGE,由 docker_deply.sh 传入
|
||||
ARG BASE_IMAGE=python:3.9-slim
|
||||
FROM ${BASE_IMAGE}
|
||||
|
||||
|
||||
# 设置工作目录
|
||||
WORKDIR /app
|
||||
|
||||
@@ -35,6 +35,8 @@ TAR_FILE="${IMAGE_NAME}-${IMAGE_TAG}.tar" # 压缩包文件名
|
||||
# 架构相关变量
|
||||
PLATFORM="linux/amd64" # 默认架构
|
||||
ARCH_SUFFIX="" # 架构后缀,用于区分不同架构的tar文件
|
||||
# 默认使用华为云源 (AMD64速度快)
|
||||
BASE_IMAGE="swr.cn-north-4.myhuaweicloud.com/ddn-k8s/docker.io/python:3.9-slim"
|
||||
|
||||
# 颜色输出
|
||||
RED='\033[0;31m'
|
||||
@@ -124,7 +126,7 @@ build_image() {
|
||||
fi
|
||||
|
||||
# 构建镜像并导出为tar文件
|
||||
docker buildx build --platform $PLATFORM -t "${IMAGE_NAME}:${IMAGE_TAG}" --output type=docker,dest="./${TAR_FILE}" .
|
||||
docker buildx build --platform $PLATFORM --build-arg BASE_IMAGE="${BASE_IMAGE}" -t "${IMAGE_NAME}:${IMAGE_TAG}" --output type=docker,dest="./${TAR_FILE}" .
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
log_success "Docker 镜像构建完成: ${TAR_FILE}"
|
||||
|
||||
8
main.py
8
main.py
@@ -327,4 +327,10 @@ async def add_user_api(user_data: AddUserRequest):
|
||||
|
||||
if __name__ == "__main__":
|
||||
import uvicorn
|
||||
uvicorn.run(app, host="0.0.0.0", port=8800)
|
||||
import argparse
|
||||
|
||||
parser = argparse.ArgumentParser(description='Run the Checkin System.')
|
||||
parser.add_argument('--port', type=int, default=8800, help='Port to run the server on')
|
||||
args = parser.parse_args()
|
||||
|
||||
uvicorn.run(app, host="0.0.0.0", port=args.port)
|
||||
|
||||
Reference in New Issue
Block a user