feat(ssa): Complete T-test end-to-end testing with 9 bug fixes - Phase 1 core 85% complete. R service: missing value auto-filter. Backend: error handling, variable matching, dynamic filename. Frontend: module activation, session isolation, error propagation. Full flow verified.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
64
r-statistics-service/Dockerfile
Normal file
64
r-statistics-service/Dockerfile
Normal file
@@ -0,0 +1,64 @@
|
||||
FROM rocker/r-ver:4.3
|
||||
|
||||
LABEL maintainer="dev-team@aiclinicalresearch.com"
|
||||
LABEL version="1.0.1"
|
||||
LABEL description="SSA-Pro R Statistics Service"
|
||||
|
||||
# 安装系统依赖(包括 R 包编译所需的库)
|
||||
RUN apt-get update && apt-get install -y \
|
||||
libcurl4-openssl-dev \
|
||||
libssl-dev \
|
||||
libxml2-dev \
|
||||
libsodium-dev \
|
||||
zlib1g-dev \
|
||||
libnlopt-dev \
|
||||
liblapack-dev \
|
||||
libblas-dev \
|
||||
gfortran \
|
||||
pkg-config \
|
||||
cmake \
|
||||
curl \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# 直接安装 R 包(简化方案,避免 renv 版本冲突)
|
||||
RUN R -e "install.packages(c( \
|
||||
'plumber', \
|
||||
'jsonlite', \
|
||||
'ggplot2', \
|
||||
'glue', \
|
||||
'dplyr', \
|
||||
'tidyr', \
|
||||
'base64enc', \
|
||||
'yaml', \
|
||||
'car', \
|
||||
'httr' \
|
||||
), repos='https://cloud.r-project.org/', Ncpus=2)"
|
||||
|
||||
# ===== 安全加固:创建非特权用户 =====
|
||||
RUN useradd -m -s /bin/bash appuser
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# 复制应用代码
|
||||
COPY plumber.R plumber.R
|
||||
COPY utils/ utils/
|
||||
COPY tools/ tools/
|
||||
COPY tests/ tests/
|
||||
|
||||
# 设置目录权限
|
||||
RUN chown -R appuser:appuser /app
|
||||
|
||||
# ===== 切换到非特权用户 =====
|
||||
USER appuser
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
# 环境变量
|
||||
ENV DEV_MODE="false"
|
||||
|
||||
# 健康检查
|
||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
||||
CMD curl -f http://localhost:8080/health || exit 1
|
||||
|
||||
# 启动服务(不清理 /tmp,避免权限问题)
|
||||
CMD ["R", "-e", "plumber::plumb('plumber.R')$run(host='0.0.0.0', port=8080)"]
|
||||
Reference in New Issue
Block a user