Skip to content

Commit 4cd1908

Browse files
committed
updated tasks to use uv and added docker multiplatform build script
1 parent 3e71ce0 commit 4cd1908

File tree

4 files changed

+309
-30
lines changed

4 files changed

+309
-30
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ __pycache__/
1010
.Python
1111
env/
1212
build/
13+
docker_build/
1314
docs_build/
1415
develop-eggs/
1516
dist/

.vscode/tasks.json

Lines changed: 101 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -18,111 +18,184 @@
1818
},
1919
},
2020
{
21-
"label": "Build Docs",
22-
"command": "sphinx-build",
23-
"args": ["-T", "-E", "${workspaceFolder}/docs", "${workspaceFolder}/.docs_build"],
21+
"label": "Build Package",
22+
"detail": "Builds the package as a wheel file in the dist/ directory",
2423
"type": "shell",
24+
"problemMatcher": [],
25+
"command": "uv",
26+
"args": ["build", "--wheel"],
2527
"presentation":
2628
{
27-
"echo": true,
2829
"reveal": "always",
30+
"clear": true,
2931
"focus": false,
3032
"panel": "shared",
31-
"showReuseMessage": false,
32-
"clear": true
3333
},
3434
},
3535
{
36-
"label": "Auto Build Docs",
37-
"command": "sphinx-autobuild",
38-
"args": ["-T", "-E", "${workspaceFolder}/docs", "${workspaceFolder}/.docs_build", "--port", "9999"],
36+
"label": "Build Docker Image",
37+
"detail": "Builds the Docker image for the application",
38+
"dependsOn": "Build Package",
39+
"type": "shell",
40+
"problemMatcher": [],
41+
"command": "docker",
42+
"args": [
43+
"build",
44+
"-t", "acockburn/appdaemon:local-dev",
45+
// "-f", "Dockerfile.uv",
46+
"${workspaceFolder}"
47+
],
48+
"presentation":
49+
{
50+
"reveal": "always",
51+
"clear": true,
52+
"focus": false,
53+
"panel": "shared",
54+
},
55+
},
56+
{
57+
"label": "Build Multi-Platform Docker Images",
58+
"detail": "Builds Docker images for multiple platforms and analyzes their sizes",
59+
"type": "shell",
60+
"problemMatcher": [],
61+
"command": "${workspaceFolder}/scripts/multiplatform-docker-build.sh",
62+
"group": "build",
63+
"presentation":
64+
{
65+
"reveal": "always",
66+
"clear": true,
67+
"focus": true,
68+
"panel": "shared",
69+
},
70+
},
71+
{
72+
"label": "Build Docs",
73+
"detail": "Builds the docs into a self-contained set of HTML files using Sphinx",
3974
"type": "shell",
75+
"problemMatcher": [],
76+
"command": "uv",
77+
"args": [
78+
"run", "--extra", "doc",
79+
"sphinx-build", "-T", "-E",
80+
"${workspaceFolder}/docs",
81+
"${workspaceFolder}/.docs_build"
82+
],
4083
"presentation":
4184
{
4285
"echo": true,
4386
"reveal": "always",
4487
"focus": false,
4588
"panel": "shared",
46-
"showReuseMessage": false,
89+
"showReuseMessage": true,
4790
"clear": true
4891
},
4992
},
5093
{
51-
"label": "Build Package",
94+
"label": "Auto Build Docs",
95+
"detail": "Runs the Sphinx documentation server on localhost:9999 with live reloading.",
96+
"type": "process",
97+
"problemMatcher": [],
5298
"command": "uv",
53-
"args": ["build"],
54-
"type": "shell",
99+
"args": [
100+
"run", "--extra", "doc",
101+
"sphinx-autobuild", "-T", "-E",
102+
"${workspaceFolder}/docs",
103+
"${workspaceFolder}/.docs_build",
104+
"--port", "9999",
105+
"--watch", "${workspaceFolder}/appdaemon",
106+
"--watch", "${workspaceFolder}/tests",
107+
],
55108
"presentation":
56109
{
57110
"echo": true,
58111
"reveal": "always",
59112
"focus": false,
60113
"panel": "shared",
61-
"showReuseMessage": false,
114+
"showReuseMessage": true,
62115
"clear": true
63116
},
64117
},
65118
{
66119
"label": "Build Runtime Requirements",
67-
"command": "uv",
68-
"args": ["pip", "compile", "--resolver=backtracking", "--upgrade", "pyproject.toml"],
69120
"type": "shell",
121+
"problemMatcher": [],
122+
"command": "uv",
123+
"args": ["pip", "compile", "--upgrade", "pyproject.toml"],
70124
"presentation":
71125
{
72126
"echo": true,
73127
"reveal": "always",
74128
"focus": false,
75129
"panel": "shared",
76-
"showReuseMessage": false,
130+
"group": "requirements",
131+
"showReuseMessage": true,
77132
"clear": true
78133
},
79134
},
80135
{
81136
"label": "Build Dev Requirements",
82-
"command": "uv",
83-
"args": ["pip", "compile", "--extra=dev", "--output-file=dev-requirements.txt", "--resolver=backtracking", "--upgrade", "pyproject.toml"],
84137
"type": "shell",
138+
"problemMatcher": [],
139+
"command": "uv",
140+
"args": [
141+
"pip", "compile",
142+
"--extra=dev",
143+
"--output-file=dev-requirements.txt",
144+
"--upgrade", "pyproject.toml"
145+
],
85146
"presentation":
86147
{
87148
"echo": true,
88149
"reveal": "always",
89150
"focus": false,
90151
"panel": "shared",
91-
"showReuseMessage": false,
152+
"group": "requirements",
153+
"showReuseMessage": true,
92154
"clear": true
93155
},
94156
},
95157
{
96158
"label": "Build Doc Requirements",
97-
"command": "uv",
98-
"args": ["pip", "compile", "--extra=doc", "--output-file=doc-requirements.txt", "--resolver=backtracking", "--upgrade", "pyproject.toml"],
99159
"type": "shell",
160+
"problemMatcher": [],
161+
"command": "uv",
162+
"args": [
163+
"pip", "compile",
164+
"--extra=doc",
165+
"--output-file=doc-requirements.txt",
166+
"--upgrade", "pyproject.toml"
167+
],
100168
"presentation":
101169
{
102170
"echo": true,
103171
"reveal": "always",
104172
"focus": false,
105173
"panel": "shared",
106-
"showReuseMessage": false,
174+
"group": "requirements",
175+
"showReuseMessage": true,
107176
"clear": true
108177
},
109178
},
110179
{
111-
"label": "Build All Requirements",
112-
"dependsOn": ["Build Runtime Requirements", "Build Dev Requirements", "Build Doc Requirements"]
180+
"label": "Build All Requirements Files",
181+
"detail": "Resolves all the dependencies into requirements files.",
182+
"dependsOn": ["Build Runtime Requirements", "Build Dev Requirements", "Build Doc Requirements"],
183+
"problemMatcher": [],
113184
},
114185
{
115186
"label": "Install Dependencies",
116-
"command": "pip",
117-
"args": ["install", "-r", "requirements.txt", "-r", "doc-requirements.txt", "-r", "dev-requirements.txt"],
187+
"detail": "Installs all the dependencies, including dev and doc extras",
118188
"type": "shell",
189+
"problemMatcher": [],
190+
"command": "uv",
191+
"args": ["sync", "--all-extras"],
119192
"presentation":
120193
{
121194
"echo": true,
122195
"reveal": "always",
123196
"focus": false,
124197
"panel": "shared",
125-
"showReuseMessage": false,
198+
"showReuseMessage": true,
126199
"clear": true
127200
},
128201
},
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ set -e
44

55
readonly REPO_DIR=$(cd $(dirname $(dirname $(readlink -f "${BASH_SOURCE[0]}"))) && pwd)
66

7-
rm -rf ./build ./dist
7+
rm -rf ${REPO_DIR}/build ${REPO_DIR}/dist
88

99
if command -v uv >/dev/null 2>&1; then
1010
uv sync -U --all-extras
@@ -17,4 +17,4 @@ else
1717
python -m build
1818
fi
1919

20-
docker build --pull -t acockburn/appdaemon:${1:-"local-dev"} .
20+
docker build --pull -t acockburn/appdaemon:${1:-"local-dev"} ${REPO_DIR}

0 commit comments

Comments
 (0)