Falln87/computer-use-agent
0
1# Stage 1: Builder2FROM node:20-alpine AS frontend-builder3 4WORKDIR /app/frontend5 6COPY cua2-front/package*.json ./7 8RUN npm ci9 10COPY cua2-front/ ./11 12RUN npm run build13 14# Stage 2: Production image15FROM python:3.11-slim16 17# Install system packages as root18RUN apt-get update && apt-get install -y \19 nginx \20 curl \21 procps \22 && rm -rf /var/lib/apt/lists/*23 24# Create a new user named "user" with user ID 100025RUN useradd -m -u 1000 user26 27# Create necessary directories with proper permissions for nginx28RUN mkdir -p /var/log/nginx /var/lib/nginx /var/cache/nginx /run \29 && chown -R user:user /var/log/nginx /var/lib/nginx /var/cache/nginx /run \30 && chmod -R 755 /var/log/nginx /var/lib/nginx /var/cache/nginx /run31 32# Switch to the "user" user33USER user34 35# Set home to the user's home directory36ENV HOME=/home/user \37 PATH=/home/user/.local/bin:$PATH38 39# Set the working directory to the user's home directory40WORKDIR $HOME/app41 42# Upgrade pip as user43RUN pip install --no-cache-dir --upgrade pip44 45# Install uv as user46RUN pip install --no-cache-dir uv47 48# Copy the project files with proper ownership49COPY --chown=user:user pyproject.toml ./50COPY --chown=user:user cua2-core/ ./cua2-core/51COPY --chown=user:user .gitattributes ./52COPY --chown=user:user .gitattributes ./cua2-core/.gitattributes53 54# Install Python dependencies55RUN uv sync --all-extras56 57# Copy frontend build with proper ownership58COPY --chown=user:user --from=frontend-builder /app/frontend/dist ./static59 60# Copy nginx config (user needs read access)61COPY --chown=user:user nginx.conf ./nginx.conf62 63# Copy entrypoint script with proper ownership and make it executable64COPY --chown=user:user entrypoint.sh ./entrypoint.sh65RUN chmod +x ./entrypoint.sh66 67EXPOSE 786068 69ENV PYTHONUNBUFFERED=170ENV HOST=0.0.0.071ENV PORT=800072 73# Use entrypoint script74ENTRYPOINT ["./entrypoint.sh"]75 