Skip to content

Commit

Permalink
Add dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
mmgoodnow committed Oct 8, 2020
1 parent ca67714 commit ed668a9
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
npm-debug.log
output
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM node:12
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm ci --only=production
COPY . .
RUN npm link
EXPOSE 2468
ENV CONFIG_DIR=/config
CMD [ "cross-seed", "daemon" ]
9 changes: 7 additions & 2 deletions src/configuration.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,15 @@ function createAppDir() {
return fs.mkdirSync(appDir(), { recursive: true });
}

function generateConfig() {
function generateConfig(force = false) {
createAppDir();
const dest = path.join(appDir(), "config.js");
fs.copyFileSync(path.join(__dirname, "config.template.js"), dest);
const configPath = path.join(__dirname, "config.template.js");
if (!force && fs.existsSync(configPath)) {
console.log("Configuration file already exists. Override with --force");
return dest;
}
fs.copyFileSync(configPath, dest);
console.log("Configuration file created at", chalk.yellow.bold(dest));
return dest;
}
Expand Down

0 comments on commit ed668a9

Please sign in to comment.