parent
							
								
									d66f172b5d
								
							
						
					
					
						commit
						6a56fdeed9
					
				| @ -0,0 +1,2 @@ | ||||
| node_modules/ | ||||
| build/ | ||||
| @ -1,14 +1,22 @@ | ||||
| const express = require("express"); | ||||
| const socketIO = require("socket.io"); | ||||
| const state = require("./state.js"); | ||||
| const path = require("path"); | ||||
| 
 | ||||
| const HOST = '0.0.0.0'; | ||||
| const PORT = 3001; | ||||
| 
 | ||||
| const app = express(); | ||||
| const server = app.listen(PORT, () => console.log(`Example app listening on port ${PORT}!`)); | ||||
| const server = app.listen(PORT, HOST,() => console.log(`Example app listening on port ${PORT}!`)); | ||||
| app.use(express.static(path.join(__dirname, '../public'))); | ||||
| 
 | ||||
| const io = socketIO(server); | ||||
| 
 | ||||
| app.get('/', (req, res) => res.send('<pre>' + JSON.stringify(state) + '</pre>')); | ||||
| app.get('/state', (req, res) => res.send('<pre>' + JSON.stringify(state) + '</pre>')); | ||||
| 
 | ||||
| process.on('SIGINT', function() { | ||||
|     process.exit(); | ||||
| }); | ||||
| 
 | ||||
| module.exports = { | ||||
|     app, server, io | ||||
|  | ||||
| @ -0,0 +1,12 @@ | ||||
| version: "3.4" | ||||
| services: | ||||
|   centurion: | ||||
|     build: | ||||
|       context: . | ||||
|       dockerfile: ./dockerfile | ||||
|     environment: | ||||
|       NODE_ENV: production | ||||
|     ports: | ||||
|       - 8800:3001 | ||||
|     restart: always | ||||
|     command: "node src/index.js" | ||||
| @ -0,0 +1,18 @@ | ||||
| # Stage 1 - the build process | ||||
| FROM node:13-alpine as build-deps | ||||
| WORKDIR /usr/src/app | ||||
| 
 | ||||
| COPY frontend/package.json frontend/package-lock.json frontend/config-overrides.js ./ | ||||
| RUN yarn | ||||
| COPY frontend/ ./ | ||||
| RUN yarn build | ||||
| 
 | ||||
| # Backend | ||||
| FROM node:13-alpine | ||||
| WORKDIR /app | ||||
| COPY backend/package.json backend/package-lock.json ./ | ||||
| RUN yarn | ||||
| COPY backend/ ./ | ||||
| COPY --from=build-deps /usr/src/app/build public | ||||
| 
 | ||||
| EXPOSE 3001 | ||||
| @ -0,0 +1,2 @@ | ||||
| node_modules/ | ||||
| build/ | ||||
					Loading…
					
					
				
		Reference in new issue