Refactor models to allow for build parameters...

Build parameters have to be parsed because they can no longer be implicitly passed, as they need to be interpreted for detecting extensions.
This commit is contained in:
Webber
2020-01-21 00:06:14 +01:00
committed by Webber Takken
parent a84535fc04
commit 1d1f81c0bb
10 changed files with 172 additions and 95 deletions

View File

@@ -1,7 +1,7 @@
import { exec } from '@actions/exec';
import ImageTag from './image-tag';
export default class Docker {
class Docker {
static async build(buildParameters, silent = false) {
const { path, dockerfile, baseImage } = buildParameters;
const { version, platform } = baseImage;
@@ -18,8 +18,16 @@ export default class Docker {
}
static async run(image, parameters, silent = false) {
const { workspace, platform, projectPath, buildName, buildsPath, method } = parameters;
const { version } = image;
const {
version,
workspace,
platform,
projectPath,
buildName,
buildPath,
buildFile,
buildMethod,
} = parameters;
const command = `docker run \
--workdir /github/workspace \
@@ -32,8 +40,9 @@ export default class Docker {
--env PROJECT_PATH=${projectPath} \
--env BUILD_TARGET=${platform} \
--env BUILD_NAME=${buildName} \
--env BUILDS_PATH=${buildsPath} \
--env BUILD_METHOD=${method} \
--env BUILD_PATH=${buildPath} \
--env BUILD_FILE=${buildFile} \
--env BUILD_METHOD=${buildMethod} \
--env HOME=/github/home \
--env GITHUB_REF \
--env GITHUB_SHA \
@@ -59,3 +68,5 @@ export default class Docker {
await exec(command, null, { silent });
}
}
export default Docker;