Skip to content
This repository was archived by the owner on Aug 5, 2023. It is now read-only.

Commit c9fe28d

Browse files
committed
Adds Docker Files
1 parent b5d4c8d commit c9fe28d

File tree

5 files changed

+68
-1
lines changed

5 files changed

+68
-1
lines changed

Dockerfile

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
FROM node:10
2+
3+
# Create app directory
4+
WORKDIR /usr/src/csgofloat-db
5+
6+
# Install app dependencies
7+
# A wildcard is used to ensure both package.json AND package-lock.json are copied
8+
# where available (npm@5+)
9+
COPY package*.json ./
10+
11+
RUN npm install
12+
13+
# Bundle app source
14+
COPY . .
15+
16+
VOLUME /config
17+
18+
CMD [ "/bin/bash", "docker_start.sh" ]

docker_start.sh

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
3+
if [ ! -f /config/config.js ]; then
4+
cp /usr/src/csgofloat-db/config.example.js /config/config.js
5+
echo "Copied example config file to /config/config.js, please edit this file and restart"
6+
exit 1
7+
fi
8+
9+
node index.js -c /config/config.js

index.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
const config = require('./config');
1+
const optionDefinitions = [
2+
{ name: 'config', alias: 'c', type: String, defaultValue: './config' } // base file path directory
3+
];
4+
5+
const args = require('command-line-args')(optionDefinitions);
6+
const config = require(args.config);
27
const vdf = require('simple-vdf');
38
const fs = require('fs');
49
const express = require('express');

package-lock.json

+34
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"name": "CSGOFloat-DB",
33
"version": "0.0.1",
44
"dependencies": {
5+
"command-line-args": "^5.1.1",
56
"express": "^4.16.4",
67
"node-fetch": "^2.3.0",
78
"pg": "^7.10.0",

0 commit comments

Comments
 (0)