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
Excluded: .git, node_modules, secrets/, compose.env, assemblyscript tgz Source: /opt/alga-psa on psa.joliet.tech
162 lines
6.2 KiB
Docker
162 lines
6.2 KiB
Docker
FROM node:20-bullseye AS base
|
|
|
|
# Install system dependencies
|
|
RUN apt-get update && apt-get install -y \
|
|
ca-certificates \
|
|
curl \
|
|
git \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
RUN curl -sSL "https://storage.googleapis.com/kubernetes-release/release/$(curl -sSL https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl" -o /usr/local/bin/kubectl \
|
|
&& chmod +x /usr/local/bin/kubectl
|
|
|
|
WORKDIR /app
|
|
ENV NODE_PATH=/app/shared/node_modules
|
|
|
|
COPY shared/ /app/shared
|
|
COPY packages/ /app/packages/
|
|
COPY server/src/ /app/server/src/
|
|
COPY server/package.json /app/server/package.json
|
|
COPY ee/server/src/ /app/ee/server/src/
|
|
COPY ee/packages/workflows/package.json /app/ee/packages/workflows/package.json
|
|
COPY ee/temporal-workflows/package*.json /app/ee/temporal-workflows/
|
|
COPY tsconfig.base.json /app/tsconfig.base.json
|
|
COPY tsconfig.json /app/tsconfig.json
|
|
|
|
WORKDIR /app/packages/integrations
|
|
RUN npm install --ignore-scripts
|
|
|
|
WORKDIR /app/ee/temporal-workflows
|
|
# Install global build tooling required by shared package scripts
|
|
RUN npm install -g typescript
|
|
# Install dependencies (skip prepare scripts to avoid building shared during base stage)
|
|
RUN npm install --ignore-scripts
|
|
|
|
# Development stage
|
|
FROM base AS development
|
|
|
|
# First, we need to copy and build shared
|
|
# Note: This assumes the Docker build context is set to project root
|
|
# with -f ee/temporal-workflows/Dockerfile
|
|
WORKDIR /app/shared
|
|
RUN npm install
|
|
RUN npm run build
|
|
RUN npm run build
|
|
|
|
# Now build temporal-workflows
|
|
WORKDIR /app
|
|
COPY ee/temporal-workflows/ /app/ee/temporal-workflows/
|
|
COPY ee/packages/workflows/ /app/ee/packages/workflows/
|
|
# Provide source files referenced via TS path aliases
|
|
COPY packages/ /app/packages/
|
|
COPY package*.json /app/
|
|
COPY .npmrc /app/
|
|
|
|
WORKDIR /app/ee/temporal-workflows
|
|
# Ensure tsc-alias is available for the build
|
|
RUN npm install
|
|
WORKDIR /app
|
|
RUN npm install --ignore-scripts --workspaces=false --legacy-peer-deps \
|
|
&& npm install --no-save openai@^4.104.0
|
|
|
|
# Build event-schemas (imported at runtime by shared/workflow/streams)
|
|
WORKDIR /app/packages/event-schemas
|
|
|
|
RUN npx tsup
|
|
|
|
# Build @alga-psa/workflows (dist/lib/*.mjs required at runtime)
|
|
WORKDIR /app/ee/packages/workflows
|
|
RUN npx tsup
|
|
|
|
WORKDIR /app/ee/temporal-workflows
|
|
RUN npm run build
|
|
|
|
# Copy onboarding seeds after build
|
|
COPY ee/server/seeds/onboarding /app/ee/temporal-workflows/dist/seeds/onboarding
|
|
|
|
# Verify seeds were copied (debug step)
|
|
RUN ls -la /app/ee/temporal-workflows/dist/seeds/onboarding || echo "Seeds directory not found"
|
|
|
|
# Prebuilt dist stage for parity/runtime validation builds.
|
|
FROM base AS prebuilt
|
|
|
|
COPY ee/temporal-workflows/dist /app/ee/temporal-workflows/dist
|
|
COPY ee/server/seeds/onboarding /app/ee/temporal-workflows/dist/seeds/onboarding
|
|
|
|
RUN ls -la /app/ee/temporal-workflows/dist/seeds/onboarding || echo "Seeds directory not found in prebuilt stage"
|
|
|
|
# Production image from prebuilt artifacts (skips in-container TypeScript compilation).
|
|
FROM base AS production-prebuilt
|
|
|
|
COPY --from=prebuilt /app/ee/temporal-workflows/dist /app/ee/temporal-workflows/dist
|
|
# Copy integrations node_modules to both locations for module resolution
|
|
COPY --from=base /app/packages/integrations/node_modules /app/packages/integrations/node_modules
|
|
COPY --from=base /app/packages/integrations/node_modules /app/ee/temporal-workflows/dist/packages/integrations/node_modules
|
|
# Expose all local monorepo packages under @alga-psa/* for runtime resolution.
|
|
RUN mkdir -p /app/node_modules/@alga-psa \
|
|
&& for pkg in /app/packages/*; do \
|
|
name="$(basename "$pkg")"; \
|
|
ln -sfn "$pkg" "/app/node_modules/@alga-psa/$name"; \
|
|
done \
|
|
&& ln -sfn /app/ee/temporal-workflows/node_modules /app/packages/node_modules
|
|
|
|
RUN ls -la /app/ee/temporal-workflows/dist/seeds/onboarding || echo "Seeds directory not found in prebuilt production stage"
|
|
|
|
RUN groupadd -r temporal && useradd -r -g temporal temporal
|
|
RUN chown -R temporal:temporal /app
|
|
USER temporal
|
|
|
|
WORKDIR /app/ee/temporal-workflows
|
|
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
|
|
CMD node -e "console.log('Health check: OK')" || exit 1
|
|
|
|
EXPOSE 8080
|
|
|
|
CMD ["node", "dist/ee/temporal-workflows/src/worker.js"]
|
|
|
|
# Production stage
|
|
FROM base AS production
|
|
|
|
# Copy built shared module
|
|
COPY --from=development /app/shared /app/shared
|
|
|
|
# Copy built temporal-workflows
|
|
COPY --from=development /app/ee/temporal-workflows/dist /app/ee/temporal-workflows/dist
|
|
COPY --from=development /app/ee/temporal-workflows/node_modules /app/ee/temporal-workflows/node_modules
|
|
COPY --from=development /app/ee/packages/workflows /app/ee/packages/workflows
|
|
# Copy event-schemas dist (runtime dependency of shared/workflow/streams)
|
|
COPY --from=development /app/packages/event-schemas/dist /app/packages/event-schemas/dist
|
|
# Copy integrations node_modules to both locations for module resolution
|
|
COPY --from=development /app/packages/integrations/node_modules /app/packages/integrations/node_modules
|
|
COPY --from=development /app/packages/integrations/node_modules /app/ee/temporal-workflows/dist/packages/integrations/node_modules
|
|
# Expose all local monorepo packages under @alga-psa/* for runtime resolution.
|
|
RUN mkdir -p /app/node_modules/@alga-psa /app/ee/temporal-workflows/node_modules/@alga-psa \
|
|
&& for pkg in /app/packages/*; do \
|
|
name="$(basename "$pkg")"; \
|
|
ln -sfn "$pkg" "/app/node_modules/@alga-psa/$name"; \
|
|
done \
|
|
&& ln -sfn /app/ee/packages/workflows /app/node_modules/@alga-psa/workflows \
|
|
&& ln -sfn /app/ee/packages/workflows /app/ee/temporal-workflows/node_modules/@alga-psa/workflows \
|
|
&& ln -sfn /app/ee/temporal-workflows/node_modules /app/packages/node_modules
|
|
|
|
# Verify seeds are present in production stage
|
|
RUN ls -la /app/ee/temporal-workflows/dist/seeds/onboarding || echo "Seeds directory not found in production stage"
|
|
|
|
# Create non-root user
|
|
RUN groupadd -r temporal && useradd -r -g temporal temporal
|
|
RUN chown -R temporal:temporal /app
|
|
USER temporal
|
|
|
|
WORKDIR /app/ee/temporal-workflows
|
|
|
|
# Health check
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
|
|
CMD node -e "console.log('Health check: OK')" || exit 1
|
|
|
|
# Expose health check port
|
|
EXPOSE 8080
|
|
|
|
# Default command runs the worker
|
|
CMD ["node", "dist/ee/temporal-workflows/src/worker.js"]
|