File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed
Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change 11use nixpacks:: create_docker_image;
22use nixpacks:: nixpacks:: builder:: docker:: DockerBuilderOptions ;
3+ use nixpacks:: nixpacks:: plan:: phase:: { Phase , StartPhase } ;
34use nixpacks:: nixpacks:: plan:: { generator:: GeneratePlanOptions , BuildPlan } ;
45
56use crate :: container:: Container ;
@@ -37,7 +38,22 @@ impl<'a> Deploy<'a> {
3738
3839 // Nix pack
3940 let envs: Vec < & str > = vec ! [ ] ;
40- let cli_plan = BuildPlan :: default ( ) ;
41+ let mut cli_plan = BuildPlan :: default ( ) ;
42+ if let Some ( install_cmds) = & self . config . install_cmd {
43+ let mut install = Phase :: install ( None ) ;
44+ install. cmds = Some ( vec ! [ install_cmds. clone( ) ] ) ;
45+ cli_plan. add_phase ( install) ;
46+ }
47+ if let Some ( build_cmds) = & self . config . build_cmd {
48+ let mut build = Phase :: build ( None ) ;
49+ build. cmds = Some ( vec ! [ build_cmds. clone( ) ] ) ;
50+ cli_plan. add_phase ( build) ;
51+ }
52+ if let Some ( start_cmd) = & self . config . start_cmd {
53+ let start = StartPhase :: new ( start_cmd. clone ( ) ) ;
54+ cli_plan. set_start_phase ( start) ;
55+ }
56+
4157 let options = GeneratePlanOptions {
4258 plan : Some ( cli_plan) ,
4359 config_file : None ,
Original file line number Diff line number Diff line change @@ -8,6 +8,12 @@ pub struct RukuConfig {
88 pub port : u16 ,
99 #[ validate( length( min = 1 , max = 20 ) ) ]
1010 pub version : Option < String > ,
11+ #[ validate( length( min = 1 , max = 50 ) ) ]
12+ pub install_cmd : Option < String > ,
13+ #[ validate( length( min = 1 , max = 50 ) ) ]
14+ pub build_cmd : Option < String > ,
15+ #[ validate( length( min = 1 , max = 50 ) ) ]
16+ pub start_cmd : Option < String > ,
1117}
1218
1319fn validate_port ( port : u16 ) -> Result < ( ) , ValidationError > {
You can’t perform that action at this time.
0 commit comments