Skip to content

Commit

Permalink
added docker support
Browse files Browse the repository at this point in the history
  • Loading branch information
pan261 committed Dec 8, 2021
1 parent b1c4a53 commit d96b2a1
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 37 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ node_modules
credentials.json
download_tests
build
File Share
FileShare
61 changes: 31 additions & 30 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,38 +21,39 @@ services:
volumes:
- ./src/build:/ffs/
- /ffs/node_modules
- ./FileShare/Gantry:/ffs/FileShare/Gantry
network_mode: host
command: "node taskRunner.js gantry"

task_runner_lathe:
build:
context: .
dockerfile: Dockerfile
env_file: ./.env
volumes:
- ./src/build:/ffs/
- /ffs/node_modules
network_mode: host
command: "node taskRunner.js lathe"
# task_runner_lathe:
# build:
# context: .
# dockerfile: Dockerfile
# env_file: ./.env
# volumes:
# - ./src/build:/ffs/
# - /ffs/node_modules
# network_mode: host
# command: "node taskRunner.js lathe"

task_runner_mill:
build:
context: .
dockerfile: Dockerfile
env_file: ./.env
volumes:
- ./src/build:/ffs/
- /ffs/node_modules
network_mode: host
command: "node taskRunner.js mill"
# task_runner_mill:
# build:
# context: .
# dockerfile: Dockerfile
# env_file: ./.env
# volumes:
# - ./src/build:/ffs/
# - /ffs/node_modules
# network_mode: host
# command: "node taskRunner.js mill"

task_runner_waterjet:
build:
context: .
dockerfile: Dockerfile
env_file: ./.env
volumes:
- ./src/build:/ffs/
- /ffs/node_modules
network_mode: host
command: "node taskRunner.js waterjet"
# task_runner_waterjet:
# build:
# context: .
# dockerfile: Dockerfile
# env_file: ./.env
# volumes:
# - ./src/build:/ffs/
# - /ffs/node_modules
# network_mode: host
# command: "node taskRunner.js waterjet"
8 changes: 4 additions & 4 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,19 @@ export const projectID = "a.YnVzaW5lc3M6cHVyZHVlMjY5NiMyMDIxMTExNTQ2Njg0NTI1MQ";
export const folderMap: any = {
gantry: {
fusionID: "urn:adsk.wipprod:fs.folder:co.IxiedfeBTOGg6NSIGQhXxQ",
local: "../../File Share/Gantry"
local: "/Gantry"
},
lathe: {
fusionID: "urn:adsk.wipprod:fs.folder:co.FDWCeyBGQX2rv8xSNWo5lg",
local: "../../File Share/Lathe"
local: "/Lathe"
},
mill: {
fusionID: "urn:adsk.wipprod:fs.folder:co.nEihcpHUSW-ZsVzU-__1iw",
local: "../../File Share/Mill"
local: "/Mill"
},
waterjet: {
fusionID: "urn:adsk.wipprod:fs.folder:co.vJLXAKGbQQayeljr-nwztQ",
local: "../../File Share/Waterjet"
local: "/Waterjet"
}
};

Expand Down
2 changes: 1 addition & 1 deletion src/downloader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ exports.download = (storageLocation: string, fileName: string, destination: stri
ObjectsApi.getObject('wip.dm.prod', storageLocation, {}, config.authClient, credentials)
.then((res: any) => {
console.log(res)
fs.writeFile(`${__dirname}/${destination}/${fileName}`, res.body)
fs.writeFile(`${destination}/${fileName}`, res.body)
})
.catch((err: any) => {
console.log("error while processing " + storageLocation);
Expand Down
18 changes: 17 additions & 1 deletion src/taskRunner.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const axios = require('axios');
const watcher = require('./watcher');
const downloader = require('./downloader');
const fs = require('fs');
import * as config from './config';


Expand All @@ -21,10 +22,25 @@ const projectID = ""
// parse command line arguments from docker-compose to get folder ID

const folderID = config.folderMap[process.argv[2]].fusionID;
const localDir = config.folderMap[process.argv[2]].local;
const localPath = config.folderMap[process.argv[2]].local;
const localRootDir = './FileShare';
const localDir = localRootDir + localPath;

console.log(folderID, localDir);

if (!fs.existsSync(localDir)) {
console.log("Local directory:", localDir, "not found, creating it now");
fs.mkdirSync(localDir, {recursive: true});
}

fs.writeFileSync(`${__dirname}/FileShare/Gantry/test.txt`, 'hello', (err: any) => {
if (err)
console.log(err);
else {
console.log('file written')
}
});

// const adminProjectID = 'a.YnVzaW5lc3M6cHVyZHVlMjY5NiMyMDIxMTEwODQ2NDQzMzk3Ng';
// const adminProjectTopFolder = 'urn:adsk.wipprod:fs.folder:co.ltuYad4ZTtieJLm6j3MGuA';

Expand Down

0 comments on commit d96b2a1

Please sign in to comment.