| FROM ghcr.io/anthropics/anthropic-quickstarts:computer-use-demo-latest |
|
|
| # Install nginx |
| USER root |
| RUN apt-get update && apt-get install -y nginx |
|
|
| # Set working directory |
| WORKDIR /home/computeruse |
|
|
| # Create nginx configuration with improved WebSocket support |
| RUN echo '\ |
| server {\n\ |
| listen 8080;\n\ |
| server_name _;\n\ |
| \n\ |
| location / {\n\ |
| proxy_pass http://127.0.0.1:6080;\n\ |
| proxy_http_version 1.1;\n\ |
| proxy_set_header Upgrade $http_upgrade;\n\ |
| proxy_set_header Connection "upgrade";\n\ |
| proxy_set_header Host $host;\n\ |
| proxy_set_header X-Real-IP $remote_addr;\n\ |
| proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n\ |
| proxy_set_header X-Forwarded-Proto $scheme;\n\ |
| proxy_buffering off;\n\ |
| }\n\ |
| \n\ |
| location /streamlit/ {\n\ |
| proxy_pass http://127.0.0.1:8501/;\n\ |
| proxy_http_version 1.1;\n\ |
| proxy_set_header Upgrade $http_upgrade;\n\ |
| proxy_set_header Connection "upgrade";\n\ |
| proxy_set_header Host $host;\n\ |
| proxy_set_header X-Real-IP $remote_addr;\n\ |
| proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n\ |
| proxy_set_header X-Forwarded-Proto $scheme;\n\ |
| proxy_buffering off;\n\ |
| }\n\ |
| \n\ |
| location /noVNC/ {\n\ |
| proxy_pass http://127.0.0.1:6080/;\n\ |
| proxy_http_version 1.1;\n\ |
| proxy_set_header Upgrade $http_upgrade;\n\ |
| proxy_set_header Connection "upgrade";\n\ |
| proxy_set_header Host $host;\n\ |
| proxy_read_timeout 61s;\n\ |
| proxy_buffering off;\n\ |
| }\n\ |
| }\n' > /etc/nginx/sites-available/default |
|
|
| # Expose only the main port |
| EXPOSE 8080 |
|
|
| ENV PORT=8080 |
| ENV STREAMLIT_SERVER_PORT=8501 |
| ENV NOVNC_PORT=6080 |
| ENV BASE_URL="/noVNC" |
| ENV STREAMLIT_BASE_URL="/streamlit" |
|
|
| # Create and set permissions for start script |
| COPY start.sh /start.sh |
| RUN chmod +x /start.sh |
|
|
| # Switch back to non-root user |
| USER 1000 |
|
|
| CMD ["/start.sh"] |