-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.all-languages
More file actions
128 lines (100 loc) · 3.38 KB
/
Dockerfile.all-languages
File metadata and controls
128 lines (100 loc) · 3.38 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# Multi-stage build for AI DevTeam Node.js application
# Stage 1: Build stage
FROM node:20-alpine AS builder
# Install build dependencies
RUN apk add --no-cache \
python3 \
make \
g++ \
git
# Set working directory
WORKDIR /app
# Copy package files
COPY package*.json pnpm-lock.yaml ./
COPY tsconfig.json ./
# Install pnpm and dependencies (including dev dependencies for build)
RUN npm install -g pnpm && pnpm install --frozen-lockfile
# Copy source code
COPY src/ ./src/
# Build the application
RUN pnpm run build
# Stage 2: Production stage
FROM node:20-alpine AS production
# Install system dependencies
RUN apk add --no-cache \
git \
openssh-client \
curl \
bash \
sudo
# Install Programming Language tools
RUN apk add --no-cache \
python3 py3-pip \
openjdk17-jdk \
go \
rust \
ruby \
docker-cli
# Install utilities
RUN apk add --no-cache \
wget \
jq \
tree
# Install GitHub CLI (Alpine Linux compatible)
RUN ARCH=$(uname -m | sed -e 's/x86_64/amd64/' -e 's/aarch64/arm64/') && \
GH_VERSION="2.76.2" && \
wget -O /tmp/gh.tar.gz "https://github.com/cli/cli/releases/download/v${GH_VERSION}/gh_${GH_VERSION}_linux_${ARCH}.tar.gz" && \
tar -xzf /tmp/gh.tar.gz -C /tmp && \
mv /tmp/gh_${GH_VERSION}_linux_${ARCH}/bin/gh /usr/local/bin/ && \
chmod +x /usr/local/bin/gh && \
rm -rf /tmp/gh*
# Install Claude CLI
# Install the official Claude CLI from npm
RUN npm install -g @anthropic-ai/claude-code || \
echo "Warning: Claude CLI installation failed. Please install manually or ensure API access is configured."
# Create app user and group
RUN addgroup -g 1001 -S appgroup && \
adduser -S appuser -u 1001 -G appgroup && \
addgroup appuser wheel
# Configure sudo for wheel group (no password required)
RUN echo "%wheel ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
# Set working directory
WORKDIR /app
# Copy package files and install production dependencies
COPY package*.json pnpm-lock.yaml ./
RUN npm install -g pnpm && pnpm install --prod --frozen-lockfile && pnpm store prune
# Copy built application from builder stage
COPY --from=builder /app/dist ./dist
# Create necessary directories with proper permissions
RUN mkdir -p /app/workspace /app/logs /app/config /app/state && \
chown -R appuser:appgroup /app
# Create Claude CLI configuration directory with proper permissions
RUN mkdir -p /home/appuser/.claude && \
chown -R appuser:appgroup /home/appuser/.claude
# Create workspace directory that can be mounted as volume
RUN mkdir -p /workspace && \
chown -R appuser:appgroup /workspace
# Switch to non-root user
USER appuser
# Set environment variables
ENV NODE_ENV=production
ENV WORKSPACE_DIR=/workspace
#ENV LOG_LEVEL=info
# Expose any ports if needed (currently none specified)
# EXPOSE 3000
# Add health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
CMD node -e "console.log('Health check: OK')" || exit 1
# Copy startup script
COPY --chown=appuser:appgroup scripts/entrypoint-all-languages.sh /app/entrypoint.sh
# Make entrypoint executable
USER root
RUN chmod +x /app/entrypoint.sh
USER appuser
# Set entrypoint and default command
ENTRYPOINT ["/app/entrypoint.sh"]
CMD ["node", "dist/index.js"]
# Labels for metadata
LABEL maintainer="AI DevTeam"
LABEL description="AI-powered development automation system using Claude Code and GitHub CLI"
LABEL version="1.0.0"