Repository navigation
152 lines (136 loc) · 5.19 KB
/
Copy pathdocker.yml
File metadata and controls
152 lines (136 loc) · 5.19 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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
name: Docker Image (Build, Test & Push)
on:
pull_request:
branches: [main]
paths:
- "Dockerfile"
- ".dockerignore"
- "docker/**"
- "data/**"
- "src/**"
- "package.json"
- "yarn.lock"
- "tests/docker/**"
- ".github/workflows/docker.yml"
push:
branches: [main]
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
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:
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@v7
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Build image (${{ matrix.arch }}, load locally)
uses: docker/build-push-action@v7
with:
context: .
load: true
tags: ${{ env.IMAGE_NAME }}:ci
- name: Use Node.js 22
uses: actions/setup-node@v7
with:
node-version: 22.x
- name: Smoke test MCP startup
env:
HARNESS_SKIP: prompt,docs,status,start,aws,logs,state,cloudpods,appinspector,chaos,iam,replicator,ephemeral,deploy,deploy-cdk,extensions,restart,stop,snowflake
run: |
node tests/docker/validate-image.mjs -- \
docker run -i --rm \
${{ env.IMAGE_NAME }}:ci
# The integration test needs the token, and GitHub gives pull requests from forks no
# secrets. Fail loud rather than skip, so a fork PR never looks tested. Placed after the
# build and the startup smoke test, which need no secret and still run for forks.
- name: Require the LocalStack auth token
# A step's if can't see its own env, so the shell checks the token.
if: matrix.arch == 'amd64'
env:
LOCALSTACK_AUTH_TOKEN: ${{ secrets.LOCALSTACK_AUTH_TOKEN }}
run: |
if [ -z "$LOCALSTACK_AUTH_TOKEN" ]; then
echo "::error::LOCALSTACK_AUTH_TOKEN is empty. GitHub gives pull requests from forks no secrets: before merging, a maintainer pushes this branch to the repository and opens a pull request from it."
exit 1
fi
- name: Integration test Docker runtime
# amd64 only: the deploys take minutes and do not depend on the image's architecture.
if: matrix.arch == 'amd64'
env:
LOCALSTACK_AUTH_TOKEN: ${{ secrets.LOCALSTACK_AUTH_TOKEN }}
HARNESS_TOKEN_REAL: ${{ secrets.LOCALSTACK_AUTH_TOKEN != '' && '1' || '0' }}
HARNESS_SKIP: cloudpods,ephemeral,replicator,chaos
run: |
npm ci --prefix data/sample-cdk
node tests/docker/validate-image.mjs -- \
docker run -i --rm \
-v /var/run/docker.sock:/var/run/docker.sock \
--add-host host.docker.internal:host-gateway \
--add-host snowflake.localhost.localstack.cloud:host-gateway \
-e LOCALSTACK_AUTH_TOKEN \
-e LOCALSTACK_HOSTNAME=host.docker.internal \
-v "$PWD/data:/work/data" \
${{ env.IMAGE_NAME }}:ci
push:
name: Build & Push (multi-arch)
needs: smoke
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref_type == 'tag')
runs-on: ubuntu-26.04
environment:
name: docker-push
deployment: false
steps:
- uses: actions/checkout@v7
- name: Set up QEMU
uses: docker/setup-qemu-action@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Log in to Docker Hub
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKER_PUSH_TOKEN }}
- name: Derive image tags
id: meta
uses: docker/metadata-action@v6
with:
images: ${{ env.IMAGE_NAME }}
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=sha,enable={{is_default_branch}}
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
flavor: |
latest=false
- name: Build and push (linux/amd64, linux/arm64)
uses: docker/build-push-action@v7
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
provenance: false
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Sync README to Docker Hub overview
if: github.ref == 'refs/heads/main'
continue-on-error: true
uses: peter-evans/dockerhub-description@v5
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKER_PUSH_TOKEN }}
repository: ${{ env.IMAGE_NAME }}
readme-filepath: ./README.md