Skip to content

Commit

Permalink
configured docker with environment variables
Browse files Browse the repository at this point in the history
  • Loading branch information
pan261 committed Dec 9, 2021
1 parent d96b2a1 commit 48c4828
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 42 deletions.
67 changes: 35 additions & 32 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ services:
- ./src/build:/ffs/
- /ffs/node_modules
ports:
- "3000:3000"
- ${PORT}:${PORT}
command: "node server.js"

task_runner_gantry:
Expand All @@ -21,39 +21,42 @@ services:
volumes:
- ./src/build:/ffs/
- /ffs/node_modules
- ./FileShare/Gantry:/ffs/FileShare/Gantry
- ${LOCAL_DIR_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
- ${LOCAL_DIR_LATHE}:/ffs/FileShare/Lathe
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
- ${LOCAL_DIR_MILL}:/ffs/FileShare/Mill
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
- ${LOCAL_DIR_WATERJET}:/ffs/FileShare/Waterjet
network_mode: host
command: "node taskRunner.js waterjet"
1 change: 1 addition & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export const authClient = new ForgeAuthClient(

export const projectID = "a.YnVzaW5lc3M6cHVyZHVlMjY5NiMyMDIxMTExNTQ2Njg0NTI1MQ";

// The local fields are only for internal/container use, host paths are specified in the environment
export const folderMap: any = {
gantry: {
fusionID: "urn:adsk.wipprod:fs.folder:co.IxiedfeBTOGg6NSIGQhXxQ",
Expand Down
19 changes: 9 additions & 10 deletions src/taskRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ const projectID = ""

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

console.log(folderID, localDir);

Expand All @@ -33,13 +32,13 @@ if (!fs.existsSync(localDir)) {
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')
}
});
// 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 Expand Up @@ -121,7 +120,7 @@ const dispatchWatcher = async (interval: any) => {

for (var index in items) {
// dispatch the downloader here
downloader.download(items[index].location, items[index].name, localDir, credentials);
downloader.download(items[index].location, items[index].name, __dirname + '/' + localDir, credentials);
}
};

Expand Down

0 comments on commit 48c4828

Please sign in to comment.