Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
71 changes: 71 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
version: 2
# Every entry waits 7 days after a release before proposing it (cooldown), so a broken or
# compromised release has time to be yanked. Security updates are not delayed.
updates:
- package-ecosystem: npm
directory: /
schedule:
interval: weekly
cooldown:
default-days: 7
open-pull-requests-limit: 5
groups:
npm-minor-patch:
Expand All @@ -17,3 +21,70 @@ updates:
- dependency-name: zod
update-types:
- version-update:semver-minor

# CLIs inside the Docker image (aws-cdk, lstk) and the CDK sample app that CI deploys with them.
- package-ecosystem: npm
directories:
- /docker/tools/npm
- /data/sample-cdk
schedule:
interval: weekly
cooldown:
default-days: 7
open-pull-requests-limit: 5
groups:
image-npm-minor-patch:
update-types:
- minor
- patch

# Python CLIs inside the Docker image: one uv project per CLI (their `rich` pins conflict).
# Each pyproject.toml sets `exclude-newer = "1 week"`, which the 7-day cooldown matches
# (https://docs.astral.sh/uv/guides/integration/dependabot/).
- package-ecosystem: uv
directories:
- /docker/tools/sam
- /docker/tools/snowflake
schedule:
interval: weekly
cooldown:
default-days: 7
open-pull-requests-limit: 5
groups:
image-uv-minor-patch:
update-types:
- minor
- patch

# FROM lines in the Dockerfile: node and hashicorp/terraform.
- package-ecosystem: docker
directory: /
schedule:
interval: weekly
cooldown:
default-days: 7
open-pull-requests-limit: 5
groups:
docker-minor-patch:
update-types:
- minor
- patch
ignore:
# Node's major follows `node-version` in the workflows and esbuild's --target in
# package.json; move all of them together by hand (src/core/dependency-pins.test.ts).
- dependency-name: node
update-types:
- version-update:semver-major

- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
cooldown:
default-days: 7
open-pull-requests-limit: 5
groups:
actions-minor-patch:
update-types:
- minor
- patch
2 changes: 1 addition & 1 deletion .github/workflows/azure-smoke.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
node-version: 22.x

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

# ubuntu-latest ships the Azure CLI.
- name: Show the Azure CLI version
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@ on:

jobs:
build:
runs-on: ubuntu-latest
runs-on: ubuntu-26.04

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Use Node.js 20
uses: actions/setup-node@v2
- name: Use Node.js 22
uses: actions/setup-node@v4
with:
node-version: 22.x

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

- name: Audit production dependencies
run: npx audit-ci --high --skip-dev
Expand All @@ -36,7 +36,7 @@ jobs:
run: yarn build

mcp-direct-tests:
runs-on: ubuntu-latest
runs-on: ubuntu-26.04
env:
LOCALSTACK_AUTH_TOKEN: ${{ secrets.LOCALSTACK_AUTH_TOKEN }}

Expand All @@ -50,7 +50,7 @@ jobs:
node-version: 22.x

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

- name: Run MCP Server Tester
run: yarn test:mcp:direct
Expand Down
28 changes: 22 additions & 6 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ on:
paths:
- "Dockerfile"
- ".dockerignore"
- "docker/**"
- "data/**"
- "src/**"
- "package.json"
- "yarn.lock"
Expand All @@ -20,17 +22,27 @@ env:
IMAGE_NAME: localstack/localstack-mcp-server

jobs:
# Each architecture builds and smoke-tests natively. arm64 catches arm64-only breakage, such as
# a locked Python package without an arm64 wheel, before the multi-arch push builds it under
# QEMU. Both runners and the push job use the same Ubuntu release (src/core/dependency-pins.test.ts).
smoke:
runs-on: ubuntu-latest
env:
CI_LOCALSTACK_AUTH_TOKEN: ${{ secrets.LOCALSTACK_AUTH_TOKEN }}
name: smoke (${{ matrix.arch }})
strategy:
fail-fast: false
matrix:
include:
- arch: amd64
runner: ubuntu-26.04
- arch: arm64
runner: ubuntu-26.04-arm
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build image (single-arch, load locally)
- name: Build image (${{ matrix.arch }}, load locally)
uses: docker/build-push-action@v6
with:
context: .
Expand All @@ -51,7 +63,11 @@ jobs:
${{ env.IMAGE_NAME }}:ci

- name: Integration test Docker runtime
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository
# amd64 only: the deploys take minutes and do not depend on the image's architecture.
# Fork PRs get no secrets, so they skip it.
if: >-
matrix.arch == 'amd64' &&
(github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository)
env:
LOCALSTACK_AUTH_TOKEN: ${{ secrets.LOCALSTACK_AUTH_TOKEN }}
HARNESS_TOKEN_REAL: ${{ secrets.LOCALSTACK_AUTH_TOKEN != '' && '1' || '0' }}
Expand All @@ -72,7 +88,7 @@ jobs:
name: Build & Push (multi-arch)
needs: smoke
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref_type == 'tag')
runs-on: ubuntu-latest
runs-on: ubuntu-26.04
environment:
name: docker-push
deployment: false
Expand Down
113 changes: 58 additions & 55 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,85 +1,88 @@
# syntax=docker/dockerfile:1

# Every tool version in this image comes from a file Dependabot updates (.github/dependabot.yml):
# node, terraform FROM lines below (docker)
# aws-cdk, lstk docker/tools/npm/package-lock.json (npm)
# uv FROM line below (docker)
# aws-sam-cli docker/tools/sam/uv.lock (uv)
# snowflake-cli docker/tools/snowflake/uv.lock (uv)
# dockerode & co. yarn.lock (npm, same lock as CI)
# Debian packages (python3, git, curl) come with the node image's bookworm base.
# Both node FROM lines must stay identical, and their major must match `node-version` in the
# workflows; src/core/dependency-pins.test.ts checks this.

# The builder only emits platform-independent JS (dist/), so it runs on the build host's
# platform. A multi-arch build then compiles once instead of once per platform under QEMU.
FROM --platform=$BUILDPLATFORM node:22-bookworm-slim AS builder
FROM --platform=$BUILDPLATFORM node:22.23.5-bookworm-slim AS builder
WORKDIR /app

COPY package.json yarn.lock ./
RUN yarn install --frozen-lockfile
COPY . .
RUN yarn build

FROM node:22-bookworm-slim AS runtime
# Terraform's official image ships a static binary, so it runs on Debian as well.
FROM hashicorp/terraform:1.17.2 AS terraform

# uv installs the Python CLIs below; it is mounted at build time and not part of the image.
FROM ghcr.io/astral-sh/uv:0.13.9 AS uv

FROM node:22.23.5-bookworm-slim AS runtime
ENV DEBIAN_FRONTEND=noninteractive \
PYTHONDONTWRITEBYTECODE=1
PYTHONDONTWRITEBYTECODE=1 \
UV_PYTHON_DOWNLOADS=0 \
UV_LINK_MODE=copy

# python3 and python3-pip also serve `sam build` for Python functions (Debian's Python 3.11;
# other Python runtimes need `sam build --use-container`).
RUN set -eux; \
apt-get update; \
apt-get install -y --no-install-recommends ca-certificates curl gnupg unzip git \
apt-get install -y --no-install-recommends ca-certificates curl unzip git \
python3 python3-pip python3-venv; \
install -m 0755 -d /usr/share/keyrings; \
curl -fsSL https://apt.releases.hashicorp.com/gpg \
| gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg; \
chmod a+r /usr/share/keyrings/hashicorp-archive-keyring.gpg; \
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com bookworm main" \
> /etc/apt/sources.list.d/hashicorp.list; \
apt-get update; \
apt-get install -y --no-install-recommends terraform; \
apt-get clean; \
rm -rf /var/lib/apt/lists/*; \
terraform version
rm -rf /var/lib/apt/lists/*

# SAM CLI comes from its official Linux installer, which bundles its own Python and dependencies.
# The checksums are the ones AWS publishes in the release notes. Snowflake CLI gets a venv of its
# own. Installing both with pip into one venv made the resolver backtrack for minutes (they pin
# conflicting `rich` versions) and settle on old releases. Snowflake's single-file binary is no
# alternative: on first run it unpacks ~400 MB of Python into $HOME.
# python3 and python3-pip also serve `sam build` for Python functions (Debian's Python 3.11;
# other Python runtimes need `sam build --use-container`).
ARG TARGETARCH
ARG SAM_CLI_VERSION=1.172.1
ARG SAM_CLI_SHA256_AMD64=aa6a5a785c576f5d8e1b783fe1633cb6eea1cbab382fa5aca1b9e17a9250cc07
ARG SAM_CLI_SHA256_ARM64=fcfc7cd414a75cc17a00c81110b2955ab52b6fae1dd8b7415d637ca95ca931df
RUN set -eux; \
case "$TARGETARCH" in \
amd64) sam_arch=x86_64; sam_sha="$SAM_CLI_SHA256_AMD64" ;; \
arm64) sam_arch=arm64; sam_sha="$SAM_CLI_SHA256_ARM64" ;; \
*) echo "unsupported TARGETARCH '$TARGETARCH'" >&2; exit 1 ;; \
esac; \
cd /tmp; \
curl -fsSLo sam.zip "https://github.com/aws/aws-sam-cli/releases/download/v${SAM_CLI_VERSION}/aws-sam-cli-linux-${sam_arch}.zip"; \
echo "${sam_sha} sam.zip" | sha256sum -c -; \
unzip -q sam.zip -d sam-installer; \
./sam-installer/install; \
rm -rf sam.zip sam-installer; \
sam --version
COPY --from=terraform /bin/terraform /usr/local/bin/terraform
RUN terraform version

# SAM CLI and Snowflake CLI each get their own venv from their own uv project: they pin
# conflicting `rich` versions, so one environment cannot hold both. uv verifies every package
# against the hashes in uv.lock, and --no-build refuses anything that would need a compiler.
RUN --mount=from=uv,source=/uv,target=/bin/uv \
--mount=type=cache,target=/root/.cache/uv \
--mount=type=bind,source=docker/tools/sam,target=/tmp/tools/sam \
UV_PROJECT_ENVIRONMENT=/opt/aws-sam-cli \
uv sync --project /tmp/tools/sam --locked --no-install-project --no-build \
--python /usr/bin/python3 \
&& find /opt/aws-sam-cli/lib -type d \( -name tests -o -name test \) -prune -exec rm -rf '{}' + \
&& ln -s /opt/aws-sam-cli/bin/sam /usr/local/bin/sam \
&& sam --version

ARG SNOWFLAKE_CLI_VERSION=3.34.0
RUN python3 -m venv /opt/snowflake-cli \
&& /opt/snowflake-cli/bin/pip install --no-cache-dir --no-compile "snowflake-cli==${SNOWFLAKE_CLI_VERSION}" \
&& find /opt/snowflake-cli/lib \
\( -type d \( -name __pycache__ -o -name tests -o -name test \) -o -type f \( -name '*.pyc' -o -name '*.pyo' \) \) \
-prune -exec rm -rf '{}' + \
RUN --mount=from=uv,source=/uv,target=/bin/uv \
--mount=type=cache,target=/root/.cache/uv \
--mount=type=bind,source=docker/tools/snowflake,target=/tmp/tools/snowflake \
UV_PROJECT_ENVIRONMENT=/opt/snowflake-cli \
uv sync --project /tmp/tools/snowflake --locked --no-install-project --no-build \
--python /usr/bin/python3 \
&& find /opt/snowflake-cli/lib -type d \( -name tests -o -name test \) -prune -exec rm -rf '{}' + \
&& ln -s /opt/snowflake-cli/bin/snow /usr/local/bin/snow \
&& snow --version

# lstk wraps terraform, cdk, and sam for the deployer tool. aws-cdk >= 2.1138 honors the
# CDK_S3_FORCE_PATH_STYLE that lstk sets, so S3 assets reach host.docker.internal path-style.
RUN npm install -g aws-cdk@2.1145.0 @localstack/lstk@1.4.2 \
&& npm cache clean --force \
&& lstk --version \
&& cdk --version
COPY docker/tools/npm/package.json docker/tools/npm/package-lock.json /opt/image-tools/npm/
RUN npm ci --prefix /opt/image-tools/npm --omit=dev --ignore-scripts --no-audit --no-fund \
&& npm cache clean --force
ENV PATH="/opt/image-tools/npm/node_modules/.bin:${PATH}"
RUN lstk --version && cdk --version

# The server's runtime dependencies (dockerode and its native-optional ssh2) come from the
# same yarn.lock CI tests with, installed for the target platform.
WORKDIR /app
RUN mkdir -p /tmp/dockerode-deps \
&& npm install --prefix /tmp/dockerode-deps --omit=dev --ignore-scripts --no-audit --no-fund dockerode@5.0.1 \
&& mkdir -p /app/node_modules \
&& cp -R /tmp/dockerode-deps/node_modules/. /app/node_modules/ \
&& rm -rf /tmp/dockerode-deps \
&& npm cache clean --force
COPY package.json yarn.lock ./
RUN yarn install --frozen-lockfile --production --ignore-scripts --non-interactive \
&& yarn cache clean
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/package.json ./package.json

# Each tool layer checks its own version above, so this step only checks the per-commit files
# and stays cheap when the tool layers come from cache.
Expand Down
Loading
Loading