Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ jobs:
tags: ${{ steps.meta.outputs.tags }}
provenance: false
sbom: false
cache-from: ${{ github.ref == 'refs/heads/main' && format('type=registry,ref={0}:latest-amd64', matrix.ghcr_image) || '' }}
Comment thread
waleedlatif1 marked this conversation as resolved.
Outdated
cache-to: type=inline

# Build ARM64 images for GHCR (main branch only, runs in parallel)
build-ghcr-arm64:
Expand Down Expand Up @@ -158,6 +160,10 @@ jobs:
tags: ${{ steps.meta.outputs.tags }}
provenance: false
sbom: false
cache-from: |
type=registry,ref=${{ matrix.image }}:latest-arm64
type=registry,ref=${{ matrix.image }}:${{ github.sha }}-arm64
cache-to: type=inline

# Create GHCR multi-arch manifests (only for main, after both builds)
create-ghcr-manifests:
Expand Down
13 changes: 12 additions & 1 deletion .github/workflows/docs-embeddings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,19 @@ jobs:
with:
node-version: latest

- name: Cache Bun dependencies
uses: actions/cache@v4
with:
path: |
~/.bun/install/cache
node_modules
**/node_modules
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lock') }}
restore-keys: |
${{ runner.os }}-bun-

- name: Install dependencies
run: bun install
run: bun install --frozen-lockfile

- name: Process docs embeddings
working-directory: ./apps/sim
Expand Down
24 changes: 23 additions & 1 deletion .github/workflows/i18n.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,17 @@ jobs:
with:
bun-version: 1.2.22

- name: Cache Bun dependencies
uses: actions/cache@v4
with:
path: |
~/.bun/install/cache
node_modules
**/node_modules
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lock') }}
restore-keys: |
${{ runner.os }}-bun-

- name: Run Lingo.dev translations
env:
LINGODOTDEV_API_KEY: ${{ secrets.LINGODOTDEV_API_KEY }}
Expand Down Expand Up @@ -117,10 +128,21 @@ jobs:
with:
bun-version: 1.2.22

- name: Cache Bun dependencies
uses: actions/cache@v4
with:
path: |
~/.bun/install/cache
node_modules
**/node_modules
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lock') }}
restore-keys: |
${{ runner.os }}-bun-

- name: Install dependencies
run: |
cd apps/docs
bun install
bun install --frozen-lockfile

- name: Build documentation to verify translations
run: |
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ jobs:
tags: ${{ steps.meta.outputs.tags }}
provenance: false
sbom: false
cache-from: ${{ github.ref == 'refs/heads/main' && format('type=registry,ref={0}:latest-amd64', matrix.ghcr_image) || '' }}
Comment thread
waleedlatif1 marked this conversation as resolved.
Outdated
cache-to: type=inline

build-ghcr-arm64:
name: Build ARM64 (GHCR Only)
Expand Down Expand Up @@ -143,6 +145,10 @@ jobs:
tags: ${{ steps.meta.outputs.tags }}
provenance: false
sbom: false
cache-from: |
type=registry,ref=${{ matrix.image }}:latest-arm64
type=registry,ref=${{ matrix.image }}:${{ github.sha }}-arm64
cache-to: type=inline

create-ghcr-manifests:
name: Create GHCR Manifests
Expand Down
13 changes: 12 additions & 1 deletion .github/workflows/migrations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,19 @@ jobs:
with:
bun-version: 1.2.22

- name: Cache Bun dependencies
uses: actions/cache@v4
with:
path: |
~/.bun/install/cache
node_modules
**/node_modules
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lock') }}
restore-keys: |
${{ runner.os }}-bun-

- name: Install dependencies
run: bun install
run: bun install --frozen-lockfile

- name: Apply migrations
working-directory: ./packages/db
Expand Down
13 changes: 12 additions & 1 deletion .github/workflows/publish-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,20 @@ jobs:
node-version: '18'
registry-url: 'https://registry.npmjs.org/'

- name: Cache Bun dependencies
uses: actions/cache@v4
with:
path: |
~/.bun/install/cache
node_modules
**/node_modules
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lock') }}
restore-keys: |
${{ runner.os }}-bun-

- name: Install dependencies
working-directory: packages/cli
run: bun install
run: bun install --frozen-lockfile

- name: Build package
working-directory: packages/cli
Expand Down
13 changes: 12 additions & 1 deletion .github/workflows/publish-ts-sdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,19 @@ jobs:
node-version: '22'
registry-url: 'https://registry.npmjs.org/'

- name: Cache Bun dependencies
uses: actions/cache@v4
with:
path: |
~/.bun/install/cache
node_modules
**/node_modules
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lock') }}
restore-keys: |
${{ runner.os }}-bun-

- name: Install dependencies
run: bun install
run: bun install --frozen-lockfile

- name: Run tests
working-directory: packages/ts-sdk
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/test-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,17 @@ jobs:
with:
node-version: latest

- name: Cache Bun dependencies
uses: actions/cache@v4
with:
path: |
~/.bun/install/cache
node_modules
**/node_modules
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lock') }}
restore-keys: |
${{ runner.os }}-bun-

- name: Install dependencies
run: bun install --frozen-lockfile

Expand Down
13 changes: 12 additions & 1 deletion .github/workflows/trigger-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,19 @@ jobs:
with:
bun-version: 1.2.22

- name: Cache Bun dependencies
uses: actions/cache@v4
with:
path: |
~/.bun/install/cache
node_modules
**/node_modules
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lock') }}
restore-keys: |
${{ runner.os }}-bun-

- name: Install dependencies
run: bun install
run: bun install --frozen-lockfile

- name: Deploy to Trigger.dev (Staging)
if: github.ref == 'refs/heads/staging'
Expand Down
28 changes: 21 additions & 7 deletions docker/app.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@ FROM base AS deps
RUN apk add --no-cache libc6-compat
WORKDIR /app

# Install turbo globally
# Install turbo globally (cached separately, changes infrequently)
RUN bun install -g turbo

COPY package.json bun.lock turbo.json ./
RUN mkdir -p apps packages/db
COPY apps/sim/package.json ./apps/sim/package.json
COPY packages/db/package.json ./packages/db/package.json

# Install dependencies (this layer will be cached if package files don't change)
RUN bun install --omit dev --ignore-scripts

# ========================================
Expand All @@ -26,14 +27,26 @@ RUN bun install --omit dev --ignore-scripts
FROM base AS builder
WORKDIR /app

# Install turbo globally in builder stage
# Install turbo globally (cached separately, changes infrequently)
RUN bun install -g turbo

# Copy node_modules from deps stage (cached if dependencies don't change)
COPY --from=deps /app/node_modules ./node_modules
COPY . .

# Installing with full context to prevent missing dependencies error
RUN bun install --omit dev --ignore-scripts
# Copy package configuration files (needed for build)
COPY package.json bun.lock turbo.json ./
COPY apps/sim/package.json ./apps/sim/package.json
COPY packages/db/package.json ./packages/db/package.json

# Copy workspace configuration files (needed for turbo)
COPY apps/sim/next.config.ts ./apps/sim/next.config.ts
COPY apps/sim/tsconfig.json ./apps/sim/tsconfig.json
COPY apps/sim/tailwind.config.ts ./apps/sim/tailwind.config.ts
COPY apps/sim/postcss.config.mjs ./apps/sim/postcss.config.mjs

# Copy source code (changes most frequently - placed last to maximize cache hits)
COPY apps/sim ./apps/sim
COPY packages ./packages

# Required for standalone nextjs build
WORKDIR /app/apps/sim
Expand Down Expand Up @@ -64,15 +77,16 @@ RUN bun run build
FROM base AS runner
WORKDIR /app

# Install Python and dependencies for guardrails PII detection
# Install Python and dependencies for guardrails PII detection (cached separately)
RUN apk add --no-cache python3 py3-pip bash

ENV NODE_ENV=production

# Create non-root user and group
# Create non-root user and group (cached separately)
RUN addgroup -g 1001 -S nodejs && \
adduser -S nextjs -u 1001

# Copy application artifacts from builder (these change on every build)
COPY --from=builder --chown=nextjs:nodejs /app/apps/sim/public ./apps/sim/public
COPY --from=builder --chown=nextjs:nodejs /app/apps/sim/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/apps/sim/.next/static ./apps/sim/.next/static
Expand Down
22 changes: 16 additions & 6 deletions docker/db.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,29 +1,39 @@
# ========================================
# Base Stage: Alpine Linux with Bun
# ========================================
FROM oven/bun:1.2.22-alpine AS base

# ========================================
# Dependencies Stage: Install Dependencies
# ========================================
FROM oven/bun:1.2.22-alpine AS deps
FROM base AS deps
WORKDIR /app

# Copy only package files needed for migrations
# Copy only package files needed for migrations (these change less frequently)
COPY package.json bun.lock turbo.json ./
RUN mkdir -p packages/db
COPY packages/db/package.json ./packages/db/package.json

# Install dependencies
# Install dependencies (this layer will be cached if package files don't change)
RUN bun install --ignore-scripts

# ========================================
# Runner Stage: Production Environment
# ========================================
FROM oven/bun:1.2.22-alpine AS runner
FROM base AS runner
WORKDIR /app

# Create non-root user and group
# Create non-root user and group (cached separately)
RUN addgroup -g 1001 -S nodejs && \
adduser -S nextjs -u 1001

# Copy only the necessary files from deps
# Copy only the necessary files from deps (cached if dependencies don't change)
COPY --from=deps --chown=nextjs:nodejs /app/node_modules ./node_modules

# Copy package configuration files (needed for migrations)
COPY --chown=nextjs:nodejs packages/db/drizzle.config.ts ./packages/db/drizzle.config.ts

# Copy database package source code (changes most frequently - placed last)
COPY --chown=nextjs:nodejs packages/db ./packages/db

# Switch to non-root user
Expand Down
32 changes: 24 additions & 8 deletions docker/realtime.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,34 @@ FROM base AS deps
RUN apk add --no-cache libc6-compat
WORKDIR /app

# Install turbo globally
# Install turbo globally (cached separately, changes infrequently)
RUN bun install -g turbo

COPY package.json bun.lock turbo.json ./
RUN mkdir -p apps packages/db
COPY apps/sim/package.json ./apps/sim/package.json
COPY packages/db/package.json ./packages/db/package.json

# Install dependencies (this layer will be cached if package files don't change)
RUN bun install --omit dev --ignore-scripts

# ========================================
# Builder Stage: Build the Application
# Builder Stage: Prepare source code
# ========================================
FROM base AS builder
WORKDIR /app

# Copy node_modules from deps stage (cached if dependencies don't change)
COPY --from=deps /app/node_modules ./node_modules
COPY . .

# Copy package configuration files (needed for build)
COPY package.json bun.lock turbo.json ./
COPY apps/sim/package.json ./apps/sim/package.json
COPY packages/db/package.json ./packages/db/package.json

# Copy source code (changes most frequently - placed last to maximize cache hits)
COPY apps/sim ./apps/sim
COPY packages ./packages

# ========================================
# Runner Stage: Run the Socket Server
Expand All @@ -37,16 +47,22 @@ WORKDIR /app

ENV NODE_ENV=production

# Create non-root user and group
# Create non-root user and group (cached separately)
RUN addgroup -g 1001 -S nodejs && \
adduser -S nextjs -u 1001

# Copy the sim app and the shared db package needed by socket-server
COPY --from=builder --chown=nextjs:nodejs /app/apps/sim ./apps/sim
COPY --from=builder --chown=nextjs:nodejs /app/packages/db ./packages/db
COPY --from=builder --chown=nextjs:nodejs /app/node_modules ./node_modules
# Copy package.json first (changes less frequently)
COPY --from=builder --chown=nextjs:nodejs /app/package.json ./package.json

# Copy node_modules from builder (cached if dependencies don't change)
COPY --from=builder --chown=nextjs:nodejs /app/node_modules ./node_modules

# Copy db package (needed by socket-server)
COPY --from=builder --chown=nextjs:nodejs /app/packages/db ./packages/db

# Copy sim app (changes most frequently - placed last)
COPY --from=builder --chown=nextjs:nodejs /app/apps/sim ./apps/sim

# Switch to non-root user
USER nextjs

Expand Down