forked from coleam00/remote-agentic-coding-system
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
66 lines (50 loc) · 1.99 KB
/
Dockerfile
File metadata and controls
66 lines (50 loc) · 1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
FROM node:20-slim
# Prevent interactive prompts during installation
ENV DEBIAN_FRONTEND=noninteractive
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
curl \
git \
bash \
ca-certificates \
gnupg \
postgresql-client \
&& rm -rf /var/lib/apt/lists/*
# Install GitHub CLI
RUN curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \
&& chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
&& apt-get update \
&& apt-get install -y gh \
&& rm -rf /var/lib/apt/lists/*
# Create non-root user for running Claude Code
# Claude Code refuses to run with --dangerously-skip-permissions as root for security
RUN useradd -m -u 1001 -s /bin/bash appuser \
&& mkdir -p /workspace \
&& chown -R appuser:appuser /app /workspace
# Copy package files
COPY package*.json ./
# Install ALL dependencies (including devDependencies for build)
RUN npm ci
# Copy application code
COPY . .
# Build TypeScript
RUN npm run build
# Remove devDependencies to reduce image size
RUN npm prune --production
# Fix permissions for appuser
RUN chown -R appuser:appuser /app
# Switch to non-root user
USER appuser
# Create .codex directory for Codex authentication
RUN mkdir -p /home/appuser/.codex
# Configure git to trust /workspace directory
# This prevents "fatal: detected dubious ownership" errors when git operations
# are performed in mounted volumes or repos cloned by different users
RUN git config --global --add safe.directory /workspace && \
git config --global --add safe.directory '/workspace/*'
# Expose port
EXPOSE 3000
# Setup Codex authentication from environment variables, then start app
CMD ["sh", "-c", "npm run setup-auth && npm start"]