Added Dockerfile for api, allow bot to be run via npm start

This commit is contained in:
TheEssem 2020-09-26 11:23:27 -05:00
parent 6e8473d784
commit 8393f599b0
3 changed files with 27 additions and 2 deletions

4
.dockerignore Normal file
View File

@ -0,0 +1,4 @@
**/node_modules
**/build
**/logs
**/data

18
Dockerfile.api Normal file
View File

@ -0,0 +1,18 @@
# Docker/Kubernetes file for running the image API
FROM node:alpine
RUN apk --no-cache upgrade && apk add --no-cache imagemagick imagemagick-dev git msttcorefonts-installer python3 alpine-sdk
RUN update-ms-fonts && fc-cache -f
RUN adduser esmBot -s /bin/sh -D
WORKDIR /home/esmBot/.internal
COPY . .
RUN npm install
RUN npm run build
USER esmBot
EXPOSE 3000
ENTRYPOINT ["node", "api/index.js"]

View File

@ -8,9 +8,12 @@
},
"scripts": {
"build": "node-gyp configure build",
"docker:build": "docker build -t headless-chrome-alpine --no-cache ./utils/screenshot",
"docker:build-api": "docker build -t esmbot-api --no-cache -f Dockerfile.api .",
"docker:build-ss": "docker build -t headless-chrome-alpine --no-cache ./utils/screenshot",
"docker:run-api": "docker run --rm --network=host esmbot-api",
"docker:run-ss": "docker run --rm --network=host --shm-size=128m headless-chrome-alpine",
"docker:run-lava": "docker run --rm --network host -v \"$(pwd)\"/application.yml:/opt/Lavalink/application.yml -v \"$(pwd)\"/assets:/opt/Lavalink/assets fredboat/lavalink:dev"
"docker:run-lava": "docker run --rm --network host -v \"$(pwd)\"/application.yml:/opt/Lavalink/application.yml -v \"$(pwd)\"/assets:/opt/Lavalink/assets fredboat/lavalink:dev",
"start": "node app.js"
},
"author": "Essem <essem@essem.space>",
"license": "MIT",