openclaw / Dockerfile
abcd118q's picture
Create Dockerfile
7279ecb verified
raw
history blame contribute delete
774 Bytes
# Stage 1: Build
FROM node:20-slim AS builder
WORKDIR /app
# Install git to clone the repo
RUN apt-get update && apt-get install -y git
# Clone OpenClaw (Change the URL if you use a specific fork)
RUN git clone https://github.com/idootop/openclaw.git .
# Install dependencies
RUN npm install
# Build the project
RUN npm run build
# Stage 2: Runtime
FROM node:20-slim
WORKDIR /app
# Copy built files from builder
COPY --from=builder /app .
# Create a directory for persistent data and set permissions
# HF Spaces use UID 1000
RUN mkdir -p /app/data && chown -R 1000:1000 /app
# Copy the start script
COPY start.sh /app/start.sh
RUN chmod +x /app/start.sh
# Set environment variables
ENV PORT=7860
ENV NODE_ENV=production
USER 1000
EXPOSE 7860
CMD ["./start.sh"]