Dockerfied!

This commit is contained in:
Martin Donnelly 2022-05-13 16:24:38 +01:00
parent 619e6ee229
commit 4cfc785c42
7 changed files with 45 additions and 1905 deletions

View File

@ -5,14 +5,16 @@ ENV VERSION ${VERSION:-development}
WORKDIR /app WORKDIR /app
COPY ./start.sh ../package*.json ./ecosystem.config.json /app/ COPY ./Docker/start.sh ./package*.json ./Docker/ecosystem.config.json /app/
COPY ./public/ /app/public COPY ./public /app/public
RUN npm install pm2 -g && npm install RUN npm install pm2 -g && npm install
# RUN ls -lh . # RUN ls -lh .
EXPOSE 9000
RUN chmod +x /app/start.sh RUN chmod +x /app/start.sh
ENTRYPOINT ["/app/start.sh"] ENTRYPOINT ["/app/start.sh"]

View File

@ -1,6 +1,6 @@
[ [
{ {
"name": "Predictor", "name": "Slack",
"script": "app/predict.js", "script": "app/predict.js",
"env": { "env": {
"NODE_ENV": "production" "NODE_ENV": "production"
@ -10,13 +10,4 @@
"cron_restart": "10 15 * * 2,5" "cron_restart": "10 15 * * 2,5"
}, },
{ {
"name": "Retriever",
"script": "app/retriever.js",
"env": {
"NODE_ENV": "production"
},
"autorestart": false,
"instances": 1,
"cron_restart": "45 9 * * 3,6"
}
] ]

View File

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/sh
set -ex set -ex
pm2-runtime start ecosystem.config.json --raw --env production pm2-runtime start npm --name Slack -- run start --raw --env production

View File

@ -10,7 +10,7 @@ NO_CACHE = true
#build docker image #build docker image
build: build:
npm run build npm run build
docker build .Docker/. -t $(APP_IMAGE) --build-arg VERSION=$(VERSION) --no-cache=$(NO_CACHE) --compress docker build ./Docker/. -t $(APP_IMAGE) --build-arg VERSION=$(VERSION) --no-cache=$(NO_CACHE) --compress=true
.PHONY: build .PHONY: build
#push docker image to registry #push docker image to registry

12
docker-compose.yml Normal file
View File

@ -0,0 +1,12 @@
version: '3.5'
services:
slack:
container_name: slack
build:
context: .
dockerfile: ./Docker/Dockerfile
image: slack_docker
ports:
- "9000:9000"

1913
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -4,7 +4,7 @@
"scripts": { "scripts": {
"build": "rollup -c", "build": "rollup -c",
"dev": "rollup -c -w", "dev": "rollup -c -w",
"start": "sirv public", "start": "sirv public -H --cors --port 9000",
"lint": "eslint . --ext .js,.svelte --fix" "lint": "eslint . --ext .js,.svelte --fix"
}, },
"devDependencies": { "devDependencies": {
@ -29,7 +29,7 @@
"fecha": "^4.2.0", "fecha": "^4.2.0",
"moment": "^2.29.1", "moment": "^2.29.1",
"rollup-plugin-replace": "^2.2.0", "rollup-plugin-replace": "^2.2.0",
"sirv-cli": "^1.0.10" "sirv-cli": "^1.0.14"
}, },
"description": "Slack.. but in a Docker container", "description": "Slack.. but in a Docker container",
"main": "rollup.config.js", "main": "rollup.config.js",