Dockerize gather

This commit is contained in:
2024-02-04 19:09:33 +03:00
parent db9180721a
commit 9a50b2c6cf
11 changed files with 2626 additions and 3049 deletions

9
gather/Dockerfile Normal file
View File

@@ -0,0 +1,9 @@
FROM node:20-alpine
LABEL authors="anatolykopyl"
WORKDIR /usr/node/app
COPY package*.json ./
RUN npm ci
COPY . .

View File

@@ -0,0 +1,9 @@
version: '3'
services:
warframe-center-gather:
image: git.radner.ru/anatolykopyl/warframe-center-gather:latest
container_name: warframe-center-gather
working_dir: /usr/node/app
command: >
sh -c "node src/index.js"

View File

@@ -1,9 +0,0 @@
module.exports = {
apps: [{
name: 'warframe-center-gather',
script: './src/index.js',
watch: true,
ignore_watch: ['node_modules', 'public'],
restart_delay: 1 * 60 * 1000
}]
}

View File

@@ -15,7 +15,6 @@
"shared-stuff": "file:../shared-stuff"
},
"devDependencies": {
"eslint-config-standard": "^16.0.3",
"pm2": "^5.2.0"
"eslint-config-standard": "^16.0.3"
}
}

View File

@@ -7,8 +7,10 @@ async function initDB () {
await mongoose.connect(process.env.MONGODB_URI)
}
(async () => {
await initDB()
const main = async (firstLaunch) => {
if (firstLaunch) {
await initDB()
}
for (const item of items) {
process.stdout.write(`Looking at ${item.name}: `)
@@ -36,5 +38,13 @@ async function initDB () {
console.log('✅')
}
await mongoose.disconnect()
})()
await main()
}
main(true)
process.on('SIGINT', () => {
mongoose.disconnect().then(() => {
process.exit()
})
})