forked from srgooglo/monstercanker
added web static service
This commit is contained in:
parent
5761947915
commit
9acf0b4448
|
@ -0,0 +1,20 @@
|
|||
FROM node:16-bullseye-slim
|
||||
|
||||
RUN apt update
|
||||
RUN apt install build-essential -y
|
||||
RUN apt install python3 -y
|
||||
RUN mkdir -p /home/node/app/node_modules && chown -R node:node /home/node/app
|
||||
|
||||
WORKDIR /home/node/app
|
||||
USER node
|
||||
|
||||
EXPOSE 3000
|
||||
|
||||
COPY --chown=node:node . .
|
||||
|
||||
RUN chmod -R 777 /home/node/app
|
||||
RUN npm install -D --force
|
||||
|
||||
RUN npm run build
|
||||
|
||||
CMD ["node", "/home/node/app/api/index.js"]
|
|
@ -1,6 +1,7 @@
|
|||
require('dotenv').config()
|
||||
|
||||
const express = require("express")
|
||||
const path = require("path")
|
||||
const cors = require("cors")
|
||||
const mlib = require("../../node_lib")
|
||||
|
||||
|
@ -32,6 +33,13 @@ async function main() {
|
|||
res.json(phrases)
|
||||
})
|
||||
|
||||
app.use(express.static(path.join(__dirname, "..", "web", "dist",)))
|
||||
|
||||
// serve static react build
|
||||
app.get("*", (req, res) => {
|
||||
res.sendFile(path.join(__dirname, "..", "web", "dist", "index.html"))
|
||||
})
|
||||
|
||||
app.listen(PORT)
|
||||
|
||||
console.log(`Listening on port ${PORT}`)
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
version: "3"
|
||||
|
||||
services:
|
||||
web:
|
||||
container_name: monstercanker-service
|
||||
build: .
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "3000:3000"
|
Loading…
Reference in New Issue