Update scripts reference to Dockerfile

This commit is contained in:
Webber 2020-01-07 22:26:15 +01:00 committed by Webber Takken
parent 81a7bbbe88
commit 18488f9b04
5 changed files with 25 additions and 5 deletions

File diff suppressed because one or more lines are too long

View File

@ -8,11 +8,11 @@ const core = require('@actions/core');
async function action() {
Action.checkCompatibility();
const { dockerfile, workspace, rootFolder } = Action;
const { dockerfile, workspace, builderFolder } = Action;
const { version, platform, projectPath, buildName, buildsPath, method } = Input.getFromUser();
const baseImage = new ImageTag({ version, platform });
const builtImage = await Docker.build({ path: rootFolder, dockerfile, baseImage });
const builtImage = await Docker.build({ path: builderFolder, dockerfile, baseImage });
await Docker.run(builtImage, { workspace, platform, projectPath, buildName, buildsPath, method });
}

View File

@ -25,8 +25,12 @@ export default class Action {
return path.dirname(path.dirname(__filename));
}
static get builderFolder() {
return `${Action.rootFolder}/builder`;
}
static get dockerfile() {
return `${Action.rootFolder}/Dockerfile`;
return `${Action.builderFolder}/Dockerfile`;
}
static get workspace() {

View File

@ -1,4 +1,5 @@
import path from 'path';
import fs from 'fs';
import Action from './action';
describe('Action', () => {
@ -16,5 +17,20 @@ describe('Action', () => {
const { rootFolder, name } = Action;
expect(path.basename(rootFolder)).toStrictEqual(name);
expect(fs.existsSync(rootFolder)).toStrictEqual(true);
});
it('returns the builder folder', () => {
const { builderFolder } = Action;
expect(path.basename(builderFolder)).toStrictEqual('builder');
expect(fs.existsSync(builderFolder)).toStrictEqual(true);
});
it('returns the docker file', () => {
const { dockerfile } = Action;
expect(path.basename(dockerfile)).toStrictEqual('Dockerfile');
expect(fs.existsSync(dockerfile)).toStrictEqual(true);
});
});

View File

@ -4,7 +4,7 @@ import ImageTag from './image-tag';
describe('Docker', () => {
it('builds', async () => {
const path = Action.rootFolder;
const path = Action.builderFolder;
const dockerfile = `${path}/Dockerfile`;
const baseImage = new ImageTag({
repository: '',