feat(server): dockerfying the server
The server has been initially dockerfied. It can be built using `docker-compose build --no-cache` and using normal docker-compose up and downs BREAKING CHANGE: The server now runs inside a docker container
This commit is contained in:
parent
f3a4d8ec66
commit
4aa46c2493
24
Docker/Dockerfile
Normal file
24
Docker/Dockerfile
Normal file
@ -0,0 +1,24 @@
|
||||
# FROM node:current-slim
|
||||
FROM martind2000/node-python3:16-slim
|
||||
ARG VERSION
|
||||
ENV VERSION ${VERSION:-development}
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY ./Docker/start.sh ./package*.json ./server.js /app/
|
||||
|
||||
COPY ./dist /app/dist
|
||||
|
||||
COPY ./server /app/server
|
||||
|
||||
copy ./db /app/db
|
||||
|
||||
RUN pnpm install
|
||||
|
||||
# RUN ls -lh .
|
||||
|
||||
EXPOSE 3000
|
||||
|
||||
RUN chmod +x /app/start.sh
|
||||
|
||||
ENTRYPOINT ["/app/start.sh"]
|
12
Docker/ecosystem.config.json
Normal file
12
Docker/ecosystem.config.json
Normal file
@ -0,0 +1,12 @@
|
||||
[
|
||||
{
|
||||
"name": "Slack",
|
||||
"script": "app/predict.js",
|
||||
"env": {
|
||||
"NODE_ENV": "production"
|
||||
},
|
||||
"autorestart": false,
|
||||
"instances": 1,
|
||||
"cron_restart": "10 15 * * 2,5"
|
||||
}
|
||||
]
|
4
Docker/start.sh
Executable file
4
Docker/start.sh
Executable file
@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
set -ex
|
||||
|
||||
node server.js
|
15
db.docker-compose.yml
Normal file
15
db.docker-compose.yml
Normal file
@ -0,0 +1,15 @@
|
||||
version: '3.5'
|
||||
|
||||
services:
|
||||
db:
|
||||
build: dbDocker
|
||||
ports:
|
||||
- "5432:5432"
|
||||
volumes:
|
||||
- postgres:/var/lib/postgresql/data
|
||||
environment:
|
||||
- POSTGRES_USER=${POSTGRES_USER}
|
||||
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
|
||||
- POSTGRES_DB=${POSTGRES_DB}
|
||||
volumes:
|
||||
postgres:
|
5
dbDocker/Dockerfile
Normal file
5
dbDocker/Dockerfile
Normal file
@ -0,0 +1,5 @@
|
||||
FROM postgres:alpine
|
||||
# ADD scripts/1_init.sql /docker-entrypoint-initdb.d
|
||||
# ADD scripts/2_copy.sql /docker-entrypoint-initdb.d
|
||||
# RUN chmod a+r /docker-entrypoint-initdb.d/*
|
||||
EXPOSE 6666
|
0
dist/build/bundle.css
vendored
Normal file → Executable file
0
dist/build/bundle.css
vendored
Normal file → Executable file
2
dist/build/bundle.js
vendored
Normal file → Executable file
2
dist/build/bundle.js
vendored
Normal file → Executable file
File diff suppressed because one or more lines are too long
2
dist/build/bundle.js.map
vendored
2
dist/build/bundle.js.map
vendored
File diff suppressed because one or more lines are too long
14
docker-compose.yml
Normal file
14
docker-compose.yml
Normal file
@ -0,0 +1,14 @@
|
||||
version: '3.5'
|
||||
|
||||
services:
|
||||
menuserver:
|
||||
container_name: menuserver
|
||||
build:
|
||||
context: .
|
||||
dockerfile: ./Docker/Dockerfile
|
||||
image: menuserver_docker
|
||||
restart: always
|
||||
ports:
|
||||
- "3000:3000"
|
||||
volumes:
|
||||
- ./dist:/app/dist
|
8017
package-lock.json
generated
8017
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
14
package.json
14
package.json
@ -10,7 +10,6 @@
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"axios": "^0.19.0",
|
||||
"backbone": "^1.4.0",
|
||||
"body-parser": "^1.19.0",
|
||||
"cors": "^2.8.5",
|
||||
"dateformat": "^3.0.3",
|
||||
@ -30,20 +29,11 @@
|
||||
"smtp-email-sender": "^1.0.0",
|
||||
"sqlite3": "^4.1.1",
|
||||
"tape": "^4.13.2",
|
||||
"tape-promise": "^4.0.0",
|
||||
"ultrases": "^0.1.3"
|
||||
"tape-promise": "^4.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"browserify": "^16.5.0",
|
||||
"eslint": "^6.6.0",
|
||||
"gulp": "^3.9.1",
|
||||
"gulp-rename": "^2.0.0",
|
||||
"gulp-sourcemaps": "^2.6.5",
|
||||
"gulp-strip-debug": "^3.0.0",
|
||||
"gulp-uglify-es": "^2.0.0",
|
||||
"gulp-util": "^3.0.8",
|
||||
"require-dir": "^1.2.0",
|
||||
"vinyl-buffer": "^1.0.1",
|
||||
"vinyl-source-stream": "^2.0.0"
|
||||
"require-dir": "^1.2.0"
|
||||
}
|
||||
}
|
||||
|
25
pg.docker-compose.yml
Normal file
25
pg.docker-compose.yml
Normal file
@ -0,0 +1,25 @@
|
||||
version: '3.5'
|
||||
|
||||
services:
|
||||
menuserver:
|
||||
container_name: menuserver
|
||||
build:
|
||||
context: .
|
||||
dockerfile: ./Docker/Dockerfile
|
||||
image: menuserver_docker
|
||||
restart: always
|
||||
ports:
|
||||
- "3000:3000"
|
||||
|
||||
postgres:
|
||||
image: "postgres:${POSTGRES_VERSION}"
|
||||
ports:
|
||||
- "5432:5432"
|
||||
volumes:
|
||||
- postgres:/var/lib/postgresql/data
|
||||
environment:
|
||||
- POSTGRES_USER=${POSTGRES_USER}
|
||||
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
|
||||
- POSTGRES_DB=${POSTGRES_DB}
|
||||
volumes:
|
||||
postgres:
|
5538
pnpm-lock.yaml
Normal file
5538
pnpm-lock.yaml
Normal file
File diff suppressed because it is too large
Load Diff
16
preload.js
16
preload.js
@ -1,5 +1,5 @@
|
||||
var sqlite3 = require('sqlite3').verbose();
|
||||
var db = new sqlite3.Database('./menu.db');
|
||||
var db = new sqlite3.Database('./menu.dbDocker');
|
||||
|
||||
const _ = require('lodash');
|
||||
const shortHash = require('short-hash');
|
||||
@ -297,15 +297,15 @@ getOne('eac12bae')
|
||||
|
||||
// console.log(obj);
|
||||
|
||||
// db.insert(obj);
|
||||
// dbDocker.insert(obj);
|
||||
/*
|
||||
db.insert({ name: 'Peter ' });
|
||||
db.insert({ name: 'Lucia' });
|
||||
db.insert({ name: 'Igor' });
|
||||
db.insert({ name: 'Stano' });
|
||||
db.insert({ name: 'Jozef' });
|
||||
dbDocker.insert({ name: 'Peter ' });
|
||||
dbDocker.insert({ name: 'Lucia' });
|
||||
dbDocker.insert({ name: 'Igor' });
|
||||
dbDocker.insert({ name: 'Stano' });
|
||||
dbDocker.insert({ name: 'Jozef' });
|
||||
*/
|
||||
|
||||
// console.log(r);
|
||||
|
||||
// db.update({ name: 'Jozef', age: 33 }).where('name', 'Jozef');
|
||||
// dbDocker.update({ name: 'Jozef', age: 33 }).where('name', 'Jozef');
|
||||
|
Loading…
Reference in New Issue
Block a user