Skip to content

Commit 3444bb9

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

62 files changed

Lines changed: 1871 additions & 776 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: 25 additions & 10 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,14 +274,15 @@ 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: [
277+
needs:
278+
[
272279
branch_build_setup,
273280
branch_build_push_admin,
274281
branch_build_push_web,
275282
branch_build_push_space,
276283
branch_build_push_live,
277284
branch_build_push_api,
278-
branch_build_push_proxy
285+
branch_build_push_proxy,
279286
]
280287
steps:
281288
- name: Checkout Files
@@ -285,7 +292,7 @@ jobs:
285292
id: prepare_aio_assets
286293
run: |
287294
cd deployments/aio/community
288-
295+
289296
if [ "${{ needs.branch_build_setup.outputs.build_type }}" == "Release" ]; then
290297
aio_version=${{ needs.branch_build_setup.outputs.release_version }}
291298
else
@@ -324,7 +331,16 @@ jobs:
324331
upload_build_assets:
325332
name: Upload Build Assets
326333
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]
334+
needs:
335+
[
336+
branch_build_setup,
337+
branch_build_push_admin,
338+
branch_build_push_web,
339+
branch_build_push_space,
340+
branch_build_push_live,
341+
branch_build_push_api,
342+
branch_build_push_proxy,
343+
]
328344
steps:
329345
- name: Checkout Files
330346
uses: actions/checkout@v4
@@ -397,4 +413,3 @@ jobs:
397413
${{ github.workspace }}/deployments/cli/community/docker-compose.yml
398414
${{ github.workspace }}/deployments/cli/community/variables.env
399415
${{ github.workspace }}/deployments/swarm/community/swarm.sh
400-

.github/workflows/docker-smoke.yml

Lines changed: 205 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,205 @@
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+
- "plane/Dockerfile.node"
17+
- "plane/Dockerfile.api"
18+
- "plane/Dockerfile.aio"
19+
- "plane/docker-bake.hcl"
20+
- ".github/workflows/docker-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+
- "plane/Dockerfile.node"
33+
- "plane/Dockerfile.api"
34+
- "plane/Dockerfile.aio"
35+
- "plane/docker-bake.hcl"
36+
- ".github/workflows/docker-smoke.yml"
37+
38+
jobs:
39+
determine-matrix:
40+
name: Determine matrix
41+
runs-on: ubuntu-latest
42+
outputs:
43+
matrix: ${{ steps.build-matrix.outputs.matrix }}
44+
aio_needed: ${{ steps.build-matrix.outputs.aio_needed }}
45+
steps:
46+
- name: Checkout repository
47+
uses: actions/checkout@v4
48+
with:
49+
fetch-depth: 0
50+
51+
- name: Detect changed paths
52+
id: changes
53+
uses: dorny/paths-filter@v3
54+
with:
55+
filters: |
56+
web:
57+
- 'apps/web/**'
58+
space:
59+
- 'apps/space/**'
60+
admin:
61+
- 'apps/admin/**'
62+
live:
63+
- 'apps/live/**'
64+
common:
65+
- 'packages/**'
66+
- 'turbo.json'
67+
- 'pnpm-lock.yaml'
68+
- 'pnpm-workspace.yaml'
69+
- 'plane/Dockerfile.node'
70+
- 'plane/Dockerfile.api'
71+
- 'plane/Dockerfile.aio'
72+
- 'plane/docker-bake.hcl'
73+
- '.github/workflows/docker-smoke.yml'
74+
75+
- name: Build matrix
76+
id: build-matrix
77+
uses: actions/github-script@v7
78+
with:
79+
script: |
80+
const include = [];
81+
const anyCommon = '${{ steps.changes.outputs.common }}' === 'true';
82+
const changed = {
83+
web: '${{ steps.changes.outputs.web }}' === 'true',
84+
space: '${{ steps.changes.outputs.space }}' === 'true',
85+
admin: '${{ steps.changes.outputs.admin }}' === 'true',
86+
live: '${{ steps.changes.outputs.live }}' === 'true',
87+
};
88+
const add = (name, bake_target, image, container, port, path, env_flags = "") =>
89+
include.push({ name, bake_target, image, container, host_port: port, path, env_flags });
90+
91+
const buildAll = anyCommon || changed.web || changed.space || changed.admin || changed.live;
92+
if (buildAll || changed.web) add('web', 'web', 'plane-web:ci-smoke', 'plane-web-ci', 3001, '/');
93+
if (buildAll || changed.space) add('space', 'space', 'plane-space:ci-smoke', 'plane-space-ci', 3002, '/spaces');
94+
if (buildAll || changed.admin) add('admin', 'admin', 'plane-admin:ci-smoke', 'plane-admin-ci', 3003, '/god-mode');
95+
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');
96+
97+
if (include.length === 0) {
98+
// Default to web to keep job non-empty
99+
add('web', 'web', 'plane-web:ci-smoke', 'plane-web-ci', 3001, '/');
100+
}
101+
// AIO is needed on the same condition we build all (common or any app changed)
102+
const aioNeeded = buildAll;
103+
core.setOutput('matrix', JSON.stringify({ include }));
104+
core.setOutput('aio_needed', String(aioNeeded));
105+
106+
smoke:
107+
name: Build and smoke test ${{ matrix.name }}
108+
runs-on: ubuntu-latest
109+
needs: determine-matrix
110+
timeout-minutes: 25
111+
112+
strategy:
113+
fail-fast: false
114+
matrix: ${{ fromJSON(needs.determine-matrix.outputs.matrix) }}
115+
116+
steps:
117+
- name: Checkout repository
118+
uses: actions/checkout@v4
119+
with:
120+
fetch-depth: 0
121+
122+
- name: Prepare build environment
123+
run: echo "Using docker build (no buildx bake)"
124+
125+
- name: Show Docker version
126+
run: |
127+
docker version
128+
docker info
129+
130+
- name: Build image (${{ matrix.name }})
131+
shell: bash
132+
run: |
133+
set -euo pipefail
134+
name="${{ matrix.name }}"
135+
tag="${{ matrix.image }}"
136+
if [ "$name" = "live" ]; then
137+
# Determine repo root (supports layouts with or without 'plane/' prefix)
138+
ROOT="."
139+
if [ -f "plane/apps/live/Dockerfile.live" ]; then ROOT="plane"; fi
140+
docker build -f "$ROOT/apps/live/Dockerfile.live" -t "$tag" "$ROOT"
141+
else
142+
ROOT="."
143+
if [ -f "plane/Dockerfile.node" ]; then ROOT="plane"; fi
144+
docker build -f "$ROOT/Dockerfile.node" --target runtime --build-arg APP_SCOPE="$name" -t "$tag" "$ROOT"
145+
fi
146+
147+
- name: Run container (${{ matrix.name }})
148+
run: |
149+
docker run -d --name ${{ matrix.container }} -p ${{ matrix.host_port }}:3000 ${{ matrix.env_flags }} ${{ matrix.image }}
150+
docker ps -a
151+
152+
- name: Smoke test HTTP endpoint (${{ matrix.name }})
153+
shell: bash
154+
run: |
155+
set -euo pipefail
156+
URL="http://localhost:${{ matrix.host_port }}${{ matrix.path }}"
157+
echo "Probing $URL ..."
158+
for i in {1..60}; do
159+
STATUS="$(curl -sS -o /dev/null -w "%{http_code}" -L "${URL}" || true)"
160+
if [ "${STATUS}" = "200" ]; then
161+
echo "Success: HTTP ${STATUS} from ${URL}"
162+
exit 0
163+
fi
164+
echo "Attempt ${i}: HTTP ${STATUS} (waiting 2s)"
165+
sleep 2
166+
done
167+
echo "Failed to get HTTP 200 from ${URL}"
168+
echo "::group::Container logs (${{ matrix.container }})"
169+
docker logs ${{ matrix.container }} || true
170+
echo "::endgroup::"
171+
exit 1
172+
173+
- name: Cleanup container (${{ matrix.name }})
174+
if: always()
175+
run: |
176+
docker rm -f ${{ matrix.container }} || true
177+
178+
aio_smoke:
179+
name: Build and smoke test AIO
180+
runs-on: ubuntu-latest
181+
needs: determine-matrix
182+
if: ${{ needs.determine-matrix.outputs.aio_needed == 'true' }}
183+
timeout-minutes: 30
184+
185+
steps:
186+
- name: Checkout repository
187+
uses: actions/checkout@v4
188+
with:
189+
fetch-depth: 0
190+
191+
- name: Set up Docker Buildx
192+
uses: docker/setup-buildx-action@v3
193+
194+
- name: Build AIO image with bake
195+
run: |
196+
ROOT="."
197+
if [ -f "plane/docker-bake.hcl" ]; then ROOT="plane"; fi
198+
docker buildx bake -f "$ROOT/docker-bake.hcl" aio
199+
200+
- name: Run AIO smoke
201+
run: |
202+
ROOT="."
203+
if [ -f "plane/scripts/smoke-aio.sh" ]; then ROOT="plane"; fi
204+
chmod +x "$ROOT/scripts/smoke-aio.sh"
205+
"$ROOT/scripts/smoke-aio.sh"

.github/workflows/pull-request-build-lint-api.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,14 @@ on:
44
workflow_dispatch:
55
pull_request:
66
branches: ["preview"]
7-
types: ["opened", "synchronize", "ready_for_review", "review_requested", "reopened"]
7+
types:
8+
[
9+
"opened",
10+
"synchronize",
11+
"ready_for_review",
12+
"review_requested",
13+
"reopened",
14+
]
815
paths:
916
- "apps/api/**"
1017

@@ -21,7 +28,7 @@ jobs:
2128
- name: Set up Python
2229
uses: actions/setup-python@v5
2330
with:
24-
python-version: "3.x"
31+
python-version: "3.12"
2532
- name: Install Pylint
2633
run: python -m pip install ruff
2734
- name: Install API Dependencies

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,4 +242,4 @@ Happy translating! 🌍✨
242242

243243
## Need help? Questions and suggestions
244244

245-
Questions, suggestions, and thoughts are most welcome. We can also be reached in our [Discord Server](https://discord.com/invite/A92xrEGCge).
245+
Questions, suggestions, and thoughts are most welcome. We can also be reached in our [Discord Server](https://discord.com/invite/A92xrEGCge).

0 commit comments

Comments
 (0)