File tree Expand file tree Collapse file tree 4 files changed +18
-3
lines changed
tests/unit/config/fixtures Expand file tree Collapse file tree 4 files changed +18
-3
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " @cartesi/cli " : patch
3+ ---
4+
5+ additional config flags to drive machine build
Original file line number Diff line number Diff line change @@ -151,6 +151,8 @@ export type MachineConfig = {
151151 ramLength : string ;
152152 ramImage : string ;
153153 store ?: string ;
154+ useDockerEnv : boolean ; // inject docker image ENV into cartesi-machine ENV
155+ useDockerWorkdir : boolean ; // inject docker image WORKDIR into cartesi-machine WORKDIR
154156 user ?: string ; // default given by cartesi-machine
155157} ;
156158
@@ -183,6 +185,8 @@ export const defaultMachineConfig = (): MachineConfig => ({
183185 ramLength : DEFAULT_RAM ,
184186 ramImage : DEFAULT_RAM_IMAGE ,
185187 store : "image" ,
188+ useDockerEnv : true ,
189+ useDockerWorkdir : true ,
186190 user : undefined ,
187191} ) ;
188192
@@ -378,6 +382,8 @@ const parseMachine = (value: TomlPrimitive): MachineConfig => {
378382 ramLength : parseString ( toml . ram_length , DEFAULT_RAM ) ,
379383 ramImage : parseString ( toml . ram_image , DEFAULT_RAM_IMAGE ) ,
380384 store : "image" ,
385+ useDockerEnv : parseBoolean ( toml . use_docker_env , true ) ,
386+ useDockerWorkdir : parseBoolean ( toml . use_docker_workdir , true ) ,
381387 user : parseOptionalString ( toml . user ) ,
382388 } ;
383389} ;
Original file line number Diff line number Diff line change @@ -35,11 +35,13 @@ export const bootMachine = (
3535 ramLength,
3636 ramImage,
3737 store,
38+ useDockerEnv,
39+ useDockerWorkdir,
3840 user,
3941 } = machine ;
4042
4143 // list of environment variables of docker image
42- const env = info ?. env ?? [ ] ;
44+ const env = useDockerEnv ? ( info ?. env ?? [ ] ) : [ ] ;
4345 const envs = env . map ( ( variable ) => `--env=${ variable } ` ) ;
4446
4547 // check if we need a rootfstype boot arg
@@ -92,7 +94,7 @@ export const bootMachine = (
9294 if ( finalHash ) {
9395 args . push ( "--final-hash" ) ;
9496 }
95- if ( info ?. workdir ) {
97+ if ( useDockerWorkdir && info ?. workdir ) {
9698 args . push ( `--workdir="${ info . workdir } "` ) ;
9799 }
98100 if ( interactive ) {
Original file line number Diff line number Diff line change 99# no_rollup = false
1010# ram_image = "/usr/share/cartesi-machine/images/linux.bin" # directory inside SDK image
1111# ram_length = "128Mi"
12+ # use_docker_env = true
13+ # use_docker_workdir = true
14+ # user = "dapp"
1215
1316# [drives.root]
1417# builder = "docker"
4144# builder = "none"
4245# filename = "./games/doom.sqfs"
4346# mount = "/usr/local/games/doom"
44-
You can’t perform that action at this time.
0 commit comments