def create_build_spec(): return BuildSpec.from_object( value={ "version": "0.2", "phases": { "build": { "commands": [ "echo $CODEBUILD_RESOLVED_SOURCE_VERSION | cut -c 1-7 > VERSION" ] } }, "artifacts": { "files": ["**/*"] }, })
def generate_buildspec(): buildspec = { "version": 0.2, "phases": { "install": { "runtime-versions": { "nodejs": "latest" }, }, "build": { "commands": [ "echo Build started on `date`", "pwd", "ls", "cd express-minapp/", "echo HOST=$HOST >> .env", "echo USERNAME=$USERNAME >> .env", "echo PASSWORD=$PASSWORD >> .env", "echo DATABASE=$DATABASE >> .env", "npm install" ], }, "post_build": { "commands": ["echo Build completed on `date`"] } }, "artifacts": { "files": [ "package.json", "src/index.js", "src/middlewares.js", "package-lock.json", ".env", ], "name": "express-minapp", "base-directory": "express-minapp" }, "cache": { "paths": ["node_modules/**/*"] } } return BuildSpec.from_object(buildspec)