8900 commited on
Update Dockerfile
Browse files- Dockerfile +17 -18
Dockerfile
CHANGED
|
@@ -1,9 +1,10 @@
|
|
| 1 |
-
FROM node:22-bookworm
|
| 2 |
|
| 3 |
-
#
|
| 4 |
RUN apt-get update && \
|
| 5 |
-
apt-get install -y --no-install-recommends
|
| 6 |
-
|
|
|
|
| 7 |
curl -fsSL https://bun.sh/install | bash
|
| 8 |
|
| 9 |
ENV PATH="/root/.bun/bin:${PATH}"
|
|
@@ -11,6 +12,7 @@ RUN corepack enable
|
|
| 11 |
|
| 12 |
WORKDIR /app
|
| 13 |
|
|
|
|
| 14 |
ARG OPENCLAW_REPO=https://github.com/Josephrp/openclaw.git
|
| 15 |
ARG OPENCLAW_REF=hf-spaces
|
| 16 |
|
|
@@ -19,26 +21,23 @@ RUN git clone --depth 1 --branch "${OPENCLAW_REF}" "${OPENCLAW_REPO}" . && \
|
|
| 19 |
pnpm build && \
|
| 20 |
pnpm ui:build
|
| 21 |
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
USER root
|
| 26 |
-
|
| 27 |
-
RUN apt-get update \
|
| 28 |
-
&& apt-get install -y --no-install-recommends nginx \
|
| 29 |
-
&& rm -rf /var/lib/apt/lists/*
|
| 30 |
-
|
| 31 |
-
RUN rm -f /etc/nginx/sites-enabled/default \
|
| 32 |
-
&& rm -f /etc/nginx/conf.d/default.conf
|
| 33 |
|
|
|
|
| 34 |
COPY nginx.conf /etc/nginx/conf.d/openclaw.conf
|
| 35 |
COPY setup-hf-config.mjs /app/setup-hf-config.mjs
|
| 36 |
COPY start.sh /start.sh
|
|
|
|
| 37 |
RUN chmod +x /start.sh
|
| 38 |
|
| 39 |
-
#
|
| 40 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
|
| 42 |
EXPOSE 7860
|
| 43 |
|
| 44 |
-
|
|
|
|
| 1 |
+
FROM node:22-bookworm
|
| 2 |
|
| 3 |
+
# 安装系统依赖
|
| 4 |
RUN apt-get update && \
|
| 5 |
+
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
|
| 6 |
+
git ca-certificates nginx \
|
| 7 |
+
&& apt-get clean && rm -rf /var/lib/apt/lists/* && \
|
| 8 |
curl -fsSL https://bun.sh/install | bash
|
| 9 |
|
| 10 |
ENV PATH="/root/.bun/bin:${PATH}"
|
|
|
|
| 12 |
|
| 13 |
WORKDIR /app
|
| 14 |
|
| 15 |
+
# 克隆并构建 OpenClaw(这是必须的步骤)
|
| 16 |
ARG OPENCLAW_REPO=https://github.com/Josephrp/openclaw.git
|
| 17 |
ARG OPENCLAW_REF=hf-spaces
|
| 18 |
|
|
|
|
| 21 |
pnpm build && \
|
| 22 |
pnpm ui:build
|
| 23 |
|
| 24 |
+
ENV OPENCLAW_PREFER_PNPM=1
|
| 25 |
+
ENV NODE_ENV=production
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
|
| 27 |
+
# 复制你的配置文件
|
| 28 |
COPY nginx.conf /etc/nginx/conf.d/openclaw.conf
|
| 29 |
COPY setup-hf-config.mjs /app/setup-hf-config.mjs
|
| 30 |
COPY start.sh /start.sh
|
| 31 |
+
|
| 32 |
RUN chmod +x /start.sh
|
| 33 |
|
| 34 |
+
# 权限设置
|
| 35 |
+
RUN chown -R node:node /app && \
|
| 36 |
+
mkdir -p /home/user && \
|
| 37 |
+
chown -R node:node /home/user
|
| 38 |
+
|
| 39 |
+
USER node
|
| 40 |
|
| 41 |
EXPOSE 7860
|
| 42 |
|
| 43 |
+
ENTRYPOINT ["/start.sh"]
|