Skip to content

Commit 1e44fbc

Browse files
committed
chore(repo): fix local docker dev
1 parent 841388e commit 1e44fbc

63 files changed

Lines changed: 1969 additions & 783 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build-branch.yml

Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,9 @@ jobs:
148148
docker-image-owner: makeplane
149149
docker-image-name: ${{ needs.branch_build_setup.outputs.dh_img_admin }}
150150
build-context: .
151-
dockerfile-path: ./apps/admin/Dockerfile.admin
151+
dockerfile-path: ./Dockerfile.node
152+
build-args: |
153+
APP_SCOPE=admin
152154
buildx-driver: ${{ needs.branch_build_setup.outputs.gh_buildx_driver }}
153155
buildx-version: ${{ needs.branch_build_setup.outputs.gh_buildx_version }}
154156
buildx-platforms: ${{ needs.branch_build_setup.outputs.gh_buildx_platforms }}
@@ -170,7 +172,9 @@ jobs:
170172
docker-image-owner: makeplane
171173
docker-image-name: ${{ needs.branch_build_setup.outputs.dh_img_web }}
172174
build-context: .
173-
dockerfile-path: ./apps/web/Dockerfile.web
175+
dockerfile-path: ./Dockerfile.node
176+
build-args: |
177+
APP_SCOPE=web
174178
buildx-driver: ${{ needs.branch_build_setup.outputs.gh_buildx_driver }}
175179
buildx-version: ${{ needs.branch_build_setup.outputs.gh_buildx_version }}
176180
buildx-platforms: ${{ needs.branch_build_setup.outputs.gh_buildx_platforms }}
@@ -192,7 +196,9 @@ jobs:
192196
docker-image-owner: makeplane
193197
docker-image-name: ${{ needs.branch_build_setup.outputs.dh_img_space }}
194198
build-context: .
195-
dockerfile-path: ./apps/space/Dockerfile.space
199+
dockerfile-path: ./Dockerfile.node
200+
build-args: |
201+
APP_SCOPE=space
196202
buildx-driver: ${{ needs.branch_build_setup.outputs.gh_buildx_driver }}
197203
buildx-version: ${{ needs.branch_build_setup.outputs.gh_buildx_version }}
198204
buildx-platforms: ${{ needs.branch_build_setup.outputs.gh_buildx_platforms }}
@@ -235,8 +241,8 @@ jobs:
235241
dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }}
236242
docker-image-owner: makeplane
237243
docker-image-name: ${{ needs.branch_build_setup.outputs.dh_img_backend }}
238-
build-context: ./apps/api
239-
dockerfile-path: ./apps/api/Dockerfile.api
244+
build-context: .
245+
dockerfile-path: ./Dockerfile.api
240246
buildx-driver: ${{ needs.branch_build_setup.outputs.gh_buildx_driver }}
241247
buildx-version: ${{ needs.branch_build_setup.outputs.gh_buildx_version }}
242248
buildx-platforms: ${{ needs.branch_build_setup.outputs.gh_buildx_platforms }}
@@ -268,15 +274,14 @@ jobs:
268274
if: ${{ needs.branch_build_setup.outputs.aio_build == 'true' }}
269275
name: Build-Push AIO Docker Image
270276
runs-on: ubuntu-22.04
271-
needs: [
272-
branch_build_setup,
273-
branch_build_push_admin,
274-
branch_build_push_web,
275-
branch_build_push_space,
276-
branch_build_push_live,
277-
branch_build_push_api,
278-
branch_build_push_proxy
279-
]
277+
needs:
278+
- branch_build_setup
279+
- branch_build_push_admin
280+
- branch_build_push_web
281+
- branch_build_push_space
282+
- branch_build_push_live
283+
- branch_build_push_api
284+
- branch_build_push_proxy
280285
steps:
281286
- name: Checkout Files
282287
uses: actions/checkout@v4
@@ -285,7 +290,7 @@ jobs:
285290
id: prepare_aio_assets
286291
run: |
287292
cd deployments/aio/community
288-
293+
289294
if [ "${{ needs.branch_build_setup.outputs.build_type }}" == "Release" ]; then
290295
aio_version=${{ needs.branch_build_setup.outputs.release_version }}
291296
else
@@ -324,7 +329,14 @@ jobs:
324329
upload_build_assets:
325330
name: Upload Build Assets
326331
runs-on: ubuntu-22.04
327-
needs: [branch_build_setup, branch_build_push_admin, branch_build_push_web, branch_build_push_space, branch_build_push_live, branch_build_push_api, branch_build_push_proxy]
332+
needs:
333+
- branch_build_setup
334+
- branch_build_push_admin
335+
- branch_build_push_web
336+
- branch_build_push_space
337+
- branch_build_push_live
338+
- branch_build_push_api
339+
- branch_build_push_proxy
328340
steps:
329341
- name: Checkout Files
330342
uses: actions/checkout@v4
@@ -397,4 +409,3 @@ jobs:
397409
${{ github.workspace }}/deployments/cli/community/docker-compose.yml
398410
${{ github.workspace }}/deployments/cli/community/variables.env
399411
${{ github.workspace }}/deployments/swarm/community/swarm.sh
400-
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
name: Docker AIO build and smoke test
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
branches: ["preview"]
7+
paths:
8+
- "apps/web/**"
9+
- "apps/space/**"
10+
- "apps/admin/**"
11+
- "apps/live/**"
12+
- "packages/**"
13+
- "turbo.json"
14+
- "pnpm-lock.yaml"
15+
- "pnpm-workspace.yaml"
16+
- "Dockerfile.node"
17+
- "Dockerfile.api"
18+
- "Dockerfile.aio"
19+
- "docker-bake.hcl"
20+
- ".github/workflows/aio-smoke.yml"
21+
push:
22+
branches: ["preview"]
23+
paths:
24+
- "apps/web/**"
25+
- "apps/space/**"
26+
- "apps/admin/**"
27+
- "apps/live/**"
28+
- "packages/**"
29+
- "turbo.json"
30+
- "pnpm-lock.yaml"
31+
- "pnpm-workspace.yaml"
32+
- "Dockerfile.node"
33+
- "Dockerfile.api"
34+
- "Dockerfile.aio"
35+
- "docker-bake.hcl"
36+
- ".github/workflows/aio-smoke.yml"
37+
38+
concurrency:
39+
group: aio-${{ github.workflow }}-${{ github.ref }}
40+
cancel-in-progress: false
41+
42+
jobs:
43+
determine-aio:
44+
name: Determine if AIO needed
45+
runs-on: ubuntu-latest
46+
outputs:
47+
aio_needed: ${{ steps.build-flag.outputs.aio_needed }}
48+
steps:
49+
- name: Checkout repository
50+
uses: actions/checkout@v4
51+
with:
52+
fetch-depth: 0
53+
54+
- name: Detect changed paths
55+
id: changes
56+
uses: dorny/paths-filter@v3
57+
with:
58+
filters: |
59+
web:
60+
- 'apps/web/**'
61+
space:
62+
- 'apps/space/**'
63+
admin:
64+
- 'apps/admin/**'
65+
live:
66+
- 'apps/live/**'
67+
common:
68+
- 'packages/**'
69+
- 'turbo.json'
70+
- 'pnpm-lock.yaml'
71+
- 'pnpm-workspace.yaml'
72+
- 'Dockerfile.node'
73+
- 'Dockerfile.api'
74+
- 'Dockerfile.aio'
75+
- 'docker-bake.hcl'
76+
- '.github/workflows/aio-smoke.yml'
77+
78+
- name: Compute AIO flag
79+
id: build-flag
80+
uses: actions/github-script@v7
81+
with:
82+
script: |
83+
const anyCommon = '${{ steps.changes.outputs.common }}' === 'true';
84+
const changedWeb = '${{ steps.changes.outputs.web }}' === 'true';
85+
const changedSpace = '${{ steps.changes.outputs.space }}' === 'true';
86+
const changedAdmin = '${{ steps.changes.outputs.admin }}' === 'true';
87+
const changedLive = '${{ steps.changes.outputs.live }}' === 'true';
88+
const aioNeeded = anyCommon || changedWeb || changedSpace || changedAdmin || changedLive;
89+
core.setOutput('aio_needed', String(aioNeeded));
90+
91+
aio_smoke:
92+
name: Build and smoke test AIO
93+
runs-on: ubuntu-latest
94+
needs: determine-aio
95+
if: ${{ needs.determine-aio.outputs.aio_needed == 'true' }}
96+
timeout-minutes: 30
97+
98+
steps:
99+
- name: Checkout repository
100+
uses: actions/checkout@v4
101+
with:
102+
fetch-depth: 0
103+
104+
- name: Show Docker version
105+
run: |
106+
docker version
107+
docker info
108+
109+
- name: Set up Docker Buildx
110+
uses: docker/setup-buildx-action@v3
111+
112+
- name: Build AIO image with bake (load into local daemon)
113+
run: |
114+
docker buildx bake -f "./docker-bake.hcl" --load aio
115+
116+
- name: Run AIO smoke script
117+
run: |
118+
chmod +x "scripts/smoke-aio.sh"
119+
"scripts/smoke-aio.sh"

.github/workflows/docker-smoke.yml

Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
name: Docker build and smoke test for apps
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
branches: ["preview"]
7+
paths:
8+
- "apps/web/**"
9+
- "apps/space/**"
10+
- "apps/admin/**"
11+
- "apps/live/**"
12+
- "packages/**"
13+
- "turbo.json"
14+
- "pnpm-lock.yaml"
15+
- "pnpm-workspace.yaml"
16+
- "Dockerfile.node"
17+
- "Dockerfile.api"
18+
19+
- ".github/workflows/docker-smoke.yml"
20+
push:
21+
branches: ["preview"]
22+
paths:
23+
- "apps/web/**"
24+
- "apps/space/**"
25+
- "apps/admin/**"
26+
- "apps/live/**"
27+
- "packages/**"
28+
- "turbo.json"
29+
- "pnpm-lock.yaml"
30+
- "pnpm-workspace.yaml"
31+
- "Dockerfile.node"
32+
- "Dockerfile.api"
33+
34+
- ".github/workflows/docker-smoke.yml"
35+
36+
jobs:
37+
determine-matrix:
38+
name: Determine matrix
39+
runs-on: ubuntu-latest
40+
outputs:
41+
matrix: ${{ steps.build-matrix.outputs.matrix }}
42+
steps:
43+
- name: Checkout repository
44+
uses: actions/checkout@v4
45+
with:
46+
fetch-depth: 0
47+
48+
- name: Detect changed paths
49+
id: changes
50+
uses: dorny/paths-filter@v3
51+
with:
52+
filters: |
53+
web:
54+
- 'apps/web/**'
55+
space:
56+
- 'apps/space/**'
57+
admin:
58+
- 'apps/admin/**'
59+
live:
60+
- 'apps/live/**'
61+
common:
62+
- 'packages/**'
63+
- 'turbo.json'
64+
- 'pnpm-lock.yaml'
65+
- 'pnpm-workspace.yaml'
66+
- 'Dockerfile.node'
67+
- 'Dockerfile.api'
68+
- 'Dockerfile.aio'
69+
- 'docker-bake.hcl'
70+
- '.github/workflows/docker-smoke.yml'
71+
72+
- name: Build matrix
73+
id: build-matrix
74+
uses: actions/github-script@v7
75+
with:
76+
script: |
77+
const include = [];
78+
const anyCommon = '${{ steps.changes.outputs.common }}' === 'true';
79+
const changed = {
80+
web: '${{ steps.changes.outputs.web }}' === 'true',
81+
space: '${{ steps.changes.outputs.space }}' === 'true',
82+
admin: '${{ steps.changes.outputs.admin }}' === 'true',
83+
live: '${{ steps.changes.outputs.live }}' === 'true',
84+
};
85+
const add = (name, bake_target, image, container, port, path, env_flags = "") =>
86+
include.push({ name, bake_target, image, container, host_port: port, path, env_flags });
87+
88+
const buildAll = anyCommon || changed.web || changed.space || changed.admin || changed.live;
89+
if (buildAll || changed.web) add('web', 'web', 'plane-web:ci-smoke', 'plane-web-ci', 3001, '/');
90+
if (buildAll || changed.space) add('space', 'space', 'plane-space:ci-smoke', 'plane-space-ci', 3002, '/spaces');
91+
if (buildAll || changed.admin) add('admin', 'admin', 'plane-admin:ci-smoke', 'plane-admin-ci', 3003, '/god-mode');
92+
if (buildAll || changed.live) add('live', 'live', 'plane-live:ci-smoke', 'plane-live-ci', 3005, '/live/health', '-e NODE_ENV=production -e LIVE_BASE_PATH=/live');
93+
94+
if (include.length === 0) {
95+
// Default to web to keep job non-empty
96+
add('web', 'web', 'plane-web:ci-smoke', 'plane-web-ci', 3001, '/');
97+
}
98+
core.setOutput('matrix', JSON.stringify({ include }));
99+
100+
smoke:
101+
name: Build and smoke test ${{ matrix.name }}
102+
runs-on: ubuntu-latest
103+
needs: determine-matrix
104+
timeout-minutes: 25
105+
106+
strategy:
107+
fail-fast: false
108+
matrix: ${{ fromJSON(needs.determine-matrix.outputs.matrix) }}
109+
110+
steps:
111+
- name: Checkout repository
112+
uses: actions/checkout@v4
113+
with:
114+
fetch-depth: 0
115+
116+
- name: Prepare build environment
117+
run: echo "Using docker build (no buildx bake)"
118+
119+
- name: Show Docker version
120+
run: |
121+
docker version
122+
docker info
123+
124+
- name: Build image (${{ matrix.name }})
125+
shell: bash
126+
run: |
127+
set -euo pipefail
128+
name="${{ matrix.name }}"
129+
tag="${{ matrix.image }}"
130+
if [ "$name" = "live" ]; then
131+
docker build -f "apps/live/Dockerfile.live" -t "$tag" "."
132+
else
133+
docker build -f "Dockerfile.node" --target runtime --build-arg APP_SCOPE="$name" -t "$tag" "."
134+
fi
135+
136+
- name: Run container (${{ matrix.name }})
137+
run: |
138+
docker run -d --name ${{ matrix.container }} -p ${{ matrix.host_port }}:3000 ${{ matrix.env_flags }} ${{ matrix.image }}
139+
docker ps -a
140+
141+
- name: Smoke test HTTP endpoint (${{ matrix.name }})
142+
shell: bash
143+
run: |
144+
set -euo pipefail
145+
URL="http://localhost:${{ matrix.host_port }}${{ matrix.path }}"
146+
echo "Probing $URL ..."
147+
for i in {1..60}; do
148+
STATUS="$(curl -sS -o /dev/null -w "%{http_code}" -L "${URL}" || true)"
149+
if [ "${STATUS}" = "200" ]; then
150+
echo "Success: HTTP ${STATUS} from ${URL}"
151+
exit 0
152+
fi
153+
echo "Attempt ${i}: HTTP ${STATUS} (waiting 2s)"
154+
sleep 2
155+
done
156+
echo "Failed to get HTTP 200 from ${URL}"
157+
echo "::group::Container logs (${{ matrix.container }})"
158+
docker logs ${{ matrix.container }} || true
159+
echo "::endgroup::"
160+
exit 1
161+
162+
- name: Cleanup container (${{ matrix.name }})
163+
if: always()
164+
run: |
165+
docker rm -f ${{ matrix.container }} || true

0 commit comments

Comments
 (0)