Skip to content

Commit 92a6c70

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

62 files changed

Lines changed: 1886 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-

.github/workflows/docker-smoke.yml

Lines changed: 201 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,201 @@
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+
- "Dockerfile.aio"
19+
- "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+
- "Dockerfile.node"
33+
- "Dockerfile.api"
34+
- "Dockerfile.aio"
35+
- "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+
- 'Dockerfile.node'
70+
- 'Dockerfile.api'
71+
- 'Dockerfile.aio'
72+
- '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+
docker build -f "./Dockerfile.node" --target runtime --build-arg APP_SCOPE="$name" -t "$tag" "."
143+
fi
144+
145+
- name: Run container (${{ matrix.name }})
146+
run: |
147+
docker run -d --name ${{ matrix.container }} -p ${{ matrix.host_port }}:3000 ${{ matrix.env_flags }} ${{ matrix.image }}
148+
docker ps -a
149+
150+
- name: Smoke test HTTP endpoint (${{ matrix.name }})
151+
shell: bash
152+
run: |
153+
set -euo pipefail
154+
URL="http://localhost:${{ matrix.host_port }}${{ matrix.path }}"
155+
echo "Probing $URL ..."
156+
for i in {1..60}; do
157+
STATUS="$(curl -sS -o /dev/null -w "%{http_code}" -L "${URL}" || true)"
158+
if [ "${STATUS}" = "200" ]; then
159+
echo "Success: HTTP ${STATUS} from ${URL}"
160+
exit 0
161+
fi
162+
echo "Attempt ${i}: HTTP ${STATUS} (waiting 2s)"
163+
sleep 2
164+
done
165+
echo "Failed to get HTTP 200 from ${URL}"
166+
echo "::group::Container logs (${{ matrix.container }})"
167+
docker logs ${{ matrix.container }} || true
168+
echo "::endgroup::"
169+
exit 1
170+
171+
- name: Cleanup container (${{ matrix.name }})
172+
if: always()
173+
run: |
174+
docker rm -f ${{ matrix.container }} || true
175+
176+
aio_smoke:
177+
name: Build and smoke test AIO
178+
runs-on: ubuntu-latest
179+
needs: determine-matrix
180+
if: ${{ needs.determine-matrix.outputs.aio_needed == 'true' }}
181+
timeout-minutes: 30
182+
183+
steps:
184+
- name: Checkout repository
185+
uses: actions/checkout@v4
186+
with:
187+
fetch-depth: 0
188+
189+
- name: Set up Docker Buildx
190+
uses: docker/setup-buildx-action@v3
191+
192+
- name: Build AIO image with bake
193+
run: |
194+
docker buildx bake -f "./docker-bake.hcl" aio
195+
196+
- name: Run AIO smoke
197+
run: |
198+
ROOT="."
199+
if [ -f "plane/scripts/smoke-aio.sh" ]; then ROOT="plane"; fi
200+
chmod +x "$ROOT/scripts/smoke-aio.sh"
201+
"$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)