PSA/docker/dev-env/Dockerfile.code-server
Hermes 284313f908
Some checks are pending
Bidi Control Character Guard / bidi-control-guard (push) Waiting to run
Circular Dependency Check / Check for new circular dependencies (push) Waiting to run
Citus Migration Smoke / Combined migrations on single-node Citus (push) Waiting to run
E2E Fresh Install Tests / fresh-install-e2e (push) Waiting to run
ext-v2 guardrails / Run ext-v2 guard and ESLint (push) Waiting to run
Integration Tests / Check for relevant changes (push) Waiting to run
Integration Tests / ${{ (github.event_name == 'schedule' || github.event.inputs.suite == 'full') && 'Full integration suite' || 'Tier-1 integration subset' }} (push) Blocked by required conditions
Mobile checks / Mobile lint + typecheck (push) Waiting to run
Mobile checks / Mobile unit tests (push) Waiting to run
Mobile checks / Mobile dependency audit (report) (push) Waiting to run
Mobile checks / Mobile reproducibility checks (push) Waiting to run
Secrets guard (env backups) / Ensure no tracked env backup files (push) Waiting to run
Temporal Readiness / fast-readiness (push) Waiting to run
Temporal Readiness / docker-parity (push) Waiting to run
TypeScript Type Check / Nx affected typecheck (push) Waiting to run
Unit Tests / Skipped-test budget (push) Waiting to run
Unit Tests / Nx affected unit tests (push) Waiting to run
Unit Tests / Server unit coverage (informational) (push) Waiting to run
Validate Tenant Management Schema / Check for relevant changes (push) Waiting to run
Validate Tenant Management Schema / Validate Tenant Management Schema (push) Blocked by required conditions
EE Workflows Build Guard / ee-workflows-build-guard (push) Waiting to run
Initial import of AlgaPSA codebase from PSA server
Excluded: .git, node_modules, secrets/, compose.env, assemblyscript tgz

Source: /opt/alga-psa on psa.joliet.tech
2026-06-22 16:12:17 -05:00

143 lines
5.4 KiB
Docker

# Alga PSA Development Environment - Code Server
# Based on the official code-server image with Node.js LTS and development tools
FROM codercom/code-server:latest
# Switch to root to install packages
USER root
# Install prerequisites and Node.js LTS
RUN apt-get update && \
apt-get install -y \
curl \
ca-certificates \
wget \
gnupg \
lsb-release \
git \
build-essential \
python3 \
python3-pip \
jq \
vim \
nano \
htop \
tree \
unzip \
sudo \
ffmpeg \
&& rm -rf /var/lib/apt/lists/*
# Give coder user sudo privileges for development tasks
RUN echo 'coder ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
# Increase file watcher limits for development
RUN echo 'fs.inotify.max_user_watches=524288' >> /etc/sysctl.conf && \
echo 'fs.inotify.max_user_instances=256' >> /etc/sysctl.conf
# Add NodeSource repository and install Node.js LTS (18.x)
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && \
apt-get install -y nodejs && \
rm -rf /var/lib/apt/lists/*
# Install global npm packages
RUN npm install -g \
@anthropic-ai/claude-code \
npm-check-updates \
typescript \
ts-node \
nodemon \
prettier \
eslint \
zstd
# Install mirrord for remote development
RUN curl -fsSL https://raw.githubusercontent.com/metalbear-co/mirrord/main/scripts/install.sh | bash
# Install kubectl
RUN curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" && \
install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl && \
rm kubectl
# Install helm
RUN curl -fsSL https://get.helm.sh/helm-v3.12.0-linux-amd64.tar.gz | tar xz && \
mv linux-amd64/helm /usr/local/bin/ && \
rm -rf linux-amd64
# Install Docker CLI (for building images from within the environment)
RUN curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg && \
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null && \
apt-get update && \
apt-get install -y docker-ce-cli && \
rm -rf /var/lib/apt/lists/*
# Install VS Code extensions that work well in the browser environment
# Use || true to continue if an extension fails to install
RUN code-server --install-extension ms-vscode.vscode-typescript-next || true && \
code-server --install-extension bradlc.vscode-tailwindcss || true && \
code-server --install-extension esbenp.prettier-vscode || true && \
code-server --install-extension redhat.vscode-yaml || true && \
code-server --install-extension ms-kubernetes-tools.vscode-kubernetes-tools || true && \
code-server --install-extension dbaeumer.vscode-eslint || true
# Create necessary directories
RUN mkdir -p /home/coder/.config/code-server && \
mkdir -p /home/coder/.local/share/code-server/User && \
mkdir -p /home/coder/.vscode-server/extensions && \
mkdir -p /home/coder/alga-psa
# Copy configuration files (will be mounted from configmap)
COPY --chown=coder:coder docker/dev-env/config/settings.json /home/coder/.local/share/code-server/User/settings.json
COPY --chown=coder:coder docker/dev-env/config/extensions.json /home/coder/.vscode-server/extensions.json
# Copy and setup startup script
COPY docker/dev-env/start-dev-env.sh /usr/local/bin/start-dev-env.sh
RUN chmod +x /usr/local/bin/start-dev-env.sh
# Pre-install npm dependencies to speed up environment startup
# Copy package files first for better Docker layer caching
COPY --chown=coder:coder package*.json /home/coder/alga-psa/
COPY --chown=coder:coder server/package*.json /home/coder/alga-psa/server/
COPY --chown=coder:coder tools/ai-automation/package*.json /home/coder/alga-psa/tools/ai-automation/
COPY --chown=coder:coder server/src/invoice-templates/assemblyscript/package*.json /home/coder/alga-psa/server/src/invoice-templates/assemblyscript/
# Ensure coder owns the entire directory structure
RUN chown -R coder:coder /home/coder/alga-psa
# Switch to coder user for npm installs
USER coder
# Set the default workspace
WORKDIR /home/coder/alga-psa
# Download and install VS Code CLI in the coder user's home directory
RUN cd /home/coder && \
curl -Lk 'https://code.visualstudio.com/sha/download?build=stable&os=cli-alpine-x64' --output vscode_cli.tar.gz && \
tar -xf vscode_cli.tar.gz && \
rm vscode_cli.tar.gz && \
echo "✅ VS Code CLI installed in /home/coder/code"
# Continue in the alga-psa directory
WORKDIR /home/coder/alga-psa
# Install dependencies during build
RUN echo "📦 Pre-installing root dependencies..." && \
npm ci --prefer-offline --no-audit && \
echo "📦 Pre-installing server dependencies..." && \
cd server && npm ci --prefer-offline --no-audit && \
cd .. && \
echo "🤖 Pre-installing AI automation dependencies..." && \
cd tools/ai-automation && npm ci --prefer-offline --no-audit && \
cd ../.. && \
echo "📄 Pre-installing AssemblyScript template dependencies..." && \
cd server/src/invoice-templates/assemblyscript && npm ci --prefer-offline --no-audit && \
cd ../..
# Switch back to root for final setup
USER root
# Expose the code-server port
EXPOSE 8080
# Use our custom startup script
ENTRYPOINT ["/usr/local/bin/start-dev-env.sh"]