update: add entrypoint
This commit is contained in:
+20
-5
@@ -19,10 +19,10 @@ RUN mkdir -p /etc/apt/keyrings \
|
|||||||
&& apt-get update && apt-get install -y nodejs --no-install-recommends \
|
&& apt-get update && apt-get install -y nodejs --no-install-recommends \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# 安装 uv 并利用 uv 下载 Python 3.11
|
# 安装 uv 并利用 uv 下载 Python 3.12
|
||||||
ENV UV_INSTALL_DIR=/opt/uv
|
ENV UV_INSTALL_DIR=/opt/uv
|
||||||
RUN curl -LsSf https://astral.sh/uv/install.sh | sh \
|
RUN curl -LsSf https://astral.sh/uv/install.sh | sh \
|
||||||
&& /opt/uv/uv python install 3.11
|
&& /opt/uv/uv python install 3.12
|
||||||
|
|
||||||
|
|
||||||
# ==========================================
|
# ==========================================
|
||||||
@@ -53,11 +53,20 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|||||||
&& apt-get autoremove -y \
|
&& apt-get autoremove -y \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# 2. 从 builder 复制 uv 和由 uv 管理的 Python 3.11
|
# 2. 从 builder 复制 uv 和由 uv 管理的 Python 3.12
|
||||||
COPY --from=builder /opt/uv/uv /usr/local/bin/uv
|
COPY --from=builder /opt/uv/uv /usr/local/bin/uv
|
||||||
COPY --from=builder /root/.local/share/uv/python /root/.local/share/uv/python
|
COPY --from=builder /root/.local/share/uv/python /root/.local/share/uv/python
|
||||||
RUN uv --version
|
RUN uv --version
|
||||||
RUN uv venv /opt/venv --python 3.11
|
|
||||||
|
COPY ./fs-backend /app/fs-backend
|
||||||
|
RUN cd /app/fs-backend && \
|
||||||
|
uv venv && \
|
||||||
|
uv pip install \
|
||||||
|
--index-url https://pypi.tuna.tsinghua.edu.cn/simple/ \
|
||||||
|
--requirements ./requirements.txt
|
||||||
|
|
||||||
|
|
||||||
|
RUN uv venv /opt/venv --python 3.12
|
||||||
ENV PATH="/opt/venv/bin:$PATH"
|
ENV PATH="/opt/venv/bin:$PATH"
|
||||||
COPY requirements.txt /tmp/requirements.txt
|
COPY requirements.txt /tmp/requirements.txt
|
||||||
RUN uv pip install \
|
RUN uv pip install \
|
||||||
@@ -71,4 +80,10 @@ RUN opencode --version
|
|||||||
COPY skills /root/.config/opencode/skills
|
COPY skills /root/.config/opencode/skills
|
||||||
COPY csv2json /root/workspace/csv2json
|
COPY csv2json /root/workspace/csv2json
|
||||||
|
|
||||||
ENTRYPOINT ["opencode"]
|
|
||||||
|
COPY ./entrypoint.sh /usr/local/bin/entrypoint.sh
|
||||||
|
RUN chmod +x /usr/local/bin/entrypoint.sh
|
||||||
|
|
||||||
|
# 入口脚本作为 ENTRYPOINT,并将 opencode 作为默认执行指令/参数
|
||||||
|
ENTRYPOINT ["entrypoint.sh"]
|
||||||
|
CMD ["opencode"]
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# 1. 在后台启动 fs-backend
|
||||||
|
echo "Starting fs-backend in background..."
|
||||||
|
cd /app/fs-backend
|
||||||
|
# 使用创建好的虚拟环境或 uv 运行服务(以 uvicorn 为例,请根据你的实际入口修改 main:app)
|
||||||
|
uv run uvicorn main:app --host 0.0.0.0 --port 8000 &
|
||||||
|
|
||||||
|
# 2. 返回根目录或原始工作目录
|
||||||
|
cd ~/workspace
|
||||||
|
|
||||||
|
# 3. 将控制权交给容器主进程(即 opencode 及传入的 CLI 参数)
|
||||||
|
exec "$@"
|
||||||
@@ -9,7 +9,7 @@ class Settings(BaseSettings):
|
|||||||
"""应用配置"""
|
"""应用配置"""
|
||||||
|
|
||||||
# 工作空间基础路径
|
# 工作空间基础路径
|
||||||
BASE_WORKSPACE: str = "/Users/mac/test/workspace"
|
BASE_WORKSPACE: str = "/root/workspace"
|
||||||
|
|
||||||
# 可通过环境变量覆盖:export BASE_WORKSPACE=/custom/path
|
# 可通过环境变量覆盖:export BASE_WORKSPACE=/custom/path
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user