@@ -131,10 +131,48 @@ def run(cli_ctx, account, runner_class, recorder_class, max_exceptions, debug, b
131
131
132
132
133
133
@cli .command (section = "Local Commands" )
134
- @click .option ("--generate" , is_flag = True , default = False )
134
+ @click .option (
135
+ "-g" ,
136
+ "--generate" ,
137
+ is_flag = True ,
138
+ default = False ,
139
+ help = "Generate Dockerfiles first. Defaults to false." ,
140
+ )
141
+ @click .option (
142
+ "-t" ,
143
+ "--tag-base" ,
144
+ default = None ,
145
+ help = (
146
+ "The base to use to tag the image. "
147
+ "The bot name (or 'bot') is appended to it, following a '-' separator. "
148
+ "Defaults to using the name of the folder you are building from."
149
+ ),
150
+ )
151
+ @click .option (
152
+ "--version" ,
153
+ default = "latest" ,
154
+ metavar = "VERSION" ,
155
+ help = "Version to use in tag. Defaults to 'latest'." ,
156
+ )
157
+ @click .option (
158
+ "--push" ,
159
+ is_flag = True ,
160
+ default = False ,
161
+ help = "Push image to logged-in registry. Defaults to false." ,
162
+ )
135
163
@click .argument ("path" , required = False , default = None )
136
- def build (generate , path ):
137
- """Generate Dockerfiles and build bot container images"""
164
+ def build (generate , tag_base , version , push , path ):
165
+ """
166
+ Generate Dockerfiles and build bot container images
167
+
168
+ When '--tag-base' is used, you can control the base of the tag for the image.
169
+ For example, '--tag-base project' with bots 'botA.py' and 'botB.py' (under 'bots/') produces
170
+ '-t project-bota:latest' and '-t project-botb:latest' respectively.
171
+
172
+ For building to push to a specific image registry, use '--tag-base' to correctly tag images.
173
+ Using '--tag-base ghcr.io/myorg/myproject' with the previous example
174
+ '-t ghcr.io/myorg/project-bota:latest' and '-t ghcr.io/myorg/project-botb:latest' respectively.
175
+ """
138
176
from silverback ._build_utils import (
139
177
IMAGES_FOLDER_NAME ,
140
178
build_docker_images ,
@@ -166,7 +204,7 @@ def build(generate, path):
166
204
"You can run `silverback build --generate` to generate it and build."
167
205
)
168
206
169
- build_docker_images ()
207
+ build_docker_images (tag_base = tag_base , version = version , push = push )
170
208
171
209
172
210
@cli .command (cls = ConnectedProviderCommand , section = "Local Commands" )
0 commit comments