|
| 1 | +# Automaker Development Dockerfile |
| 2 | +# For development with live reload via volume mounting |
| 3 | +# Source code is NOT copied - it's mounted as a volume |
| 4 | +# |
| 5 | +# Usage: |
| 6 | +# docker compose -f docker-compose.dev.yml up |
| 7 | + |
| 8 | +FROM node:22-slim |
| 9 | + |
| 10 | +# Install build dependencies for native modules (node-pty) and runtime tools |
| 11 | +RUN apt-get update && apt-get install -y --no-install-recommends \ |
| 12 | + python3 make g++ \ |
| 13 | + git curl bash gosu ca-certificates openssh-client \ |
| 14 | + && GH_VERSION="2.63.2" \ |
| 15 | + && ARCH=$(uname -m) \ |
| 16 | + && case "$ARCH" in \ |
| 17 | + x86_64) GH_ARCH="amd64" ;; \ |
| 18 | + aarch64|arm64) GH_ARCH="arm64" ;; \ |
| 19 | + *) echo "Unsupported architecture: $ARCH" && exit 1 ;; \ |
| 20 | + esac \ |
| 21 | + && curl -L "https://github.com/cli/cli/releases/download/v${GH_VERSION}/gh_${GH_VERSION}_linux_${GH_ARCH}.tar.gz" -o gh.tar.gz \ |
| 22 | + && tar -xzf gh.tar.gz \ |
| 23 | + && mv gh_${GH_VERSION}_linux_${GH_ARCH}/bin/gh /usr/local/bin/gh \ |
| 24 | + && rm -rf gh.tar.gz gh_${GH_VERSION}_linux_${GH_ARCH} \ |
| 25 | + && rm -rf /var/lib/apt/lists/* |
| 26 | + |
| 27 | +# Install Claude CLI globally |
| 28 | +RUN npm install -g @anthropic-ai/claude-code |
| 29 | + |
| 30 | +# Create non-root user |
| 31 | +RUN groupadd -g 1001 automaker && \ |
| 32 | + useradd -u 1001 -g automaker -m -d /home/automaker -s /bin/bash automaker && \ |
| 33 | + mkdir -p /home/automaker/.local/bin && \ |
| 34 | + mkdir -p /home/automaker/.cursor && \ |
| 35 | + chown -R automaker:automaker /home/automaker && \ |
| 36 | + chmod 700 /home/automaker/.cursor |
| 37 | + |
| 38 | +# Install Cursor CLI as automaker user |
| 39 | +USER automaker |
| 40 | +ENV HOME=/home/automaker |
| 41 | +RUN curl https://cursor.com/install -fsS | bash || true |
| 42 | +USER root |
| 43 | + |
| 44 | +# Add PATH to profile for Cursor CLI |
| 45 | +RUN mkdir -p /etc/profile.d && \ |
| 46 | + echo 'export PATH="/home/automaker/.local/bin:$PATH"' > /etc/profile.d/cursor-cli.sh && \ |
| 47 | + chmod +x /etc/profile.d/cursor-cli.sh |
| 48 | + |
| 49 | +# Add to user bashrc files |
| 50 | +RUN echo 'export PATH="/home/automaker/.local/bin:$PATH"' >> /home/automaker/.bashrc && \ |
| 51 | + chown automaker:automaker /home/automaker/.bashrc |
| 52 | +RUN echo 'export PATH="/home/automaker/.local/bin:$PATH"' >> /root/.bashrc |
| 53 | + |
| 54 | +WORKDIR /app |
| 55 | + |
| 56 | +# Create directories with proper permissions |
| 57 | +RUN mkdir -p /data /projects && chown automaker:automaker /data /projects |
| 58 | + |
| 59 | +# Configure git for mounted volumes |
| 60 | +RUN git config --system --add safe.directory '*' && \ |
| 61 | + git config --system credential.helper '!gh auth git-credential' |
| 62 | + |
| 63 | +# Copy entrypoint script |
| 64 | +COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh |
| 65 | +RUN chmod +x /usr/local/bin/docker-entrypoint.sh |
| 66 | + |
| 67 | +# Environment variables |
| 68 | +ENV PORT=3008 |
| 69 | +ENV DATA_DIR=/data |
| 70 | +ENV HOME=/home/automaker |
| 71 | +ENV PATH="/home/automaker/.local/bin:${PATH}" |
| 72 | + |
| 73 | +# Expose both dev ports |
| 74 | +EXPOSE 3007 3008 |
| 75 | + |
| 76 | +# Use entrypoint for permission handling |
| 77 | +ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"] |
| 78 | + |
| 79 | +# Default command - will be overridden by docker-compose |
| 80 | +CMD ["npm", "run", "dev:web"] |
0 commit comments