mirror of
https://github.com/cupcakearmy/dvb.git
synced 2024-12-22 16:16:26 +00:00
Moved to docker for production
This commit is contained in:
parent
8ae8e99897
commit
2b91123838
1
cache/.key.sample
vendored
Normal file
1
cache/.key.sample
vendored
Normal file
@ -0,0 +1 @@
|
||||
db597413fa4f4a8545b0f2bb43262f11
|
12
cache/cache.js → cache/app.js
vendored
12
cache/cache.js → cache/app.js
vendored
@ -2,9 +2,13 @@ const http = require('http')
|
||||
const https = require('https')
|
||||
|
||||
// GET YOUR OWN AT: https://openweathermap.org/appid
|
||||
const APP_KEY = 'db597413fa4f4a8545b0f2bb43262f11'
|
||||
const APP_KEY = require('fs').readFileSync(__dirname + '/.key', {
|
||||
encoding: 'utf-8',
|
||||
flag: 'r'
|
||||
}).trim()
|
||||
|
||||
const LISTEN = '8000'
|
||||
const HOST = '0.0.0.0'
|
||||
|
||||
const REGEXP = {
|
||||
URL: /^\/[\d]{1,8}$/
|
||||
@ -67,7 +71,7 @@ function getUrlFromPath(path) {
|
||||
return path.replace('/', '')
|
||||
}
|
||||
|
||||
const server = http.createServer(async(req, res) => {
|
||||
const server = http.createServer(async (req, res) => {
|
||||
|
||||
const zip = getUrlFromPath(req.url)
|
||||
// Check if url is valid
|
||||
@ -96,8 +100,8 @@ function exit() {
|
||||
}
|
||||
|
||||
function start() {
|
||||
console.log(`Started server on: ${LISTEN}`)
|
||||
server.listen(LISTEN)
|
||||
console.log(`Started server on: ${LISTEN}. Using Key: ${APP_KEY}`)
|
||||
server.listen(LISTEN, HOST)
|
||||
}
|
||||
|
||||
// Register exit function
|
9
cache/docker-compose.yml
vendored
Normal file
9
cache/docker-compose.yml
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
version: "3.5"
|
||||
|
||||
services:
|
||||
cache:
|
||||
build: .
|
||||
user: nobody
|
||||
ports:
|
||||
- 8000:8000
|
||||
restart: always
|
10
cache/dockerfile
vendored
Normal file
10
cache/dockerfile
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
FROM node:alpine
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
WORKDIR /app
|
||||
USER nobody
|
||||
COPY ./app.js ./.key ./
|
||||
|
||||
ENTRYPOINT [ "node" ]
|
||||
CMD [ "app.js" ]
|
Loading…
Reference in New Issue
Block a user