build(server): update customer compile image
This commit is contained in:
+15
-2
@@ -1,4 +1,4 @@
|
|||||||
FROM condaforge/miniforge3:latest
|
FROM condaforge/miniforge3:latest AS runtime-base
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
@@ -14,9 +14,22 @@ COPY requirements.txt .
|
|||||||
RUN pip install --no-cache-dir uv
|
RUN pip install --no-cache-dir uv
|
||||||
RUN uv pip install --system --no-cache-dir -r requirements.txt
|
RUN uv pip install --system --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
|
FROM runtime-base AS builder
|
||||||
|
|
||||||
|
RUN mamba install -y c-compiler cxx-compiler && \
|
||||||
|
mamba clean -afy
|
||||||
|
|
||||||
|
COPY app ./app
|
||||||
|
COPY scripts ./scripts
|
||||||
|
|
||||||
|
RUN python scripts/compile.py && \
|
||||||
|
python scripts/compile.py --delete-source
|
||||||
|
|
||||||
|
FROM runtime-base AS runner
|
||||||
|
|
||||||
# 将代码放入子目录 'app',将数据放入子目录 'db_inp'
|
# 将代码放入子目录 'app',将数据放入子目录 'db_inp'
|
||||||
# 这样临时文件默认会生成在 /app 下,而代码在 /app/app 下,实现了分离
|
# 这样临时文件默认会生成在 /app 下,而代码在 /app/app 下,实现了分离
|
||||||
COPY app ./app
|
COPY --from=builder /app/app ./app
|
||||||
RUN python -c "from pathlib import Path; from zipfile import ZipFile; model_dir = Path('app/algorithms/health/model'); zip_path = model_dir / 'my_survival_forest_model_quxi.zip'; joblib_name = 'my_survival_forest_model_quxi.joblib'; joblib_path = model_dir / joblib_name; assert zip_path.exists(), f'Model archive not found: {zip_path}'; archive = ZipFile(zip_path); archive.extract(joblib_name, model_dir); archive.close(); assert joblib_path.exists(), f'Model file not extracted: {joblib_path}'" && \
|
RUN python -c "from pathlib import Path; from zipfile import ZipFile; model_dir = Path('app/algorithms/health/model'); zip_path = model_dir / 'my_survival_forest_model_quxi.zip'; joblib_name = 'my_survival_forest_model_quxi.joblib'; joblib_path = model_dir / joblib_name; assert zip_path.exists(), f'Model archive not found: {zip_path}'; archive = ZipFile(zip_path); archive.extract(joblib_name, model_dir); archive.close(); assert joblib_path.exists(), f'Model file not extracted: {joblib_path}'" && \
|
||||||
rm -f app/algorithms/health/model/my_survival_forest_model_quxi.zip
|
rm -f app/algorithms/health/model/my_survival_forest_model_quxi.zip
|
||||||
# COPY db_inp ./db_inp
|
# COPY db_inp ./db_inp
|
||||||
|
|||||||
+2
-2
@@ -212,10 +212,10 @@ if __name__ == "__main__":
|
|||||||
if len(sys.argv) > 1:
|
if len(sys.argv) > 1:
|
||||||
if sys.argv[1] == "--clean":
|
if sys.argv[1] == "--clean":
|
||||||
clean_mode = True
|
clean_mode = True
|
||||||
target_directories = sys.argv[2:]
|
target_directories = sys.argv[2:] or DEFAULT_TARGETS
|
||||||
elif sys.argv[1] == "--delete-source":
|
elif sys.argv[1] == "--delete-source":
|
||||||
delete_source_mode = True
|
delete_source_mode = True
|
||||||
target_directories = sys.argv[2:]
|
target_directories = sys.argv[2:] or DEFAULT_TARGETS
|
||||||
else:
|
else:
|
||||||
target_directories = sys.argv[1:]
|
target_directories = sys.argv[1:]
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user