💚 update docker

docker-deployment
Vincent ASTOLFI 9 months ago
parent 1d3aa1a3fe
commit 5678950806

@ -1,8 +1,16 @@
FROM node:16
FROM node:14
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm install
COPY . .
#RUN sed -i '1i\<base href="https://codefirst.iut.uca.fr/containers/vincentastolfi-maettleship/">' ./public/index.html
EXPOSE 8080
CMD ["npm", "run", "start"]
EXPOSE 3000
ENV DB_HOST=db
ENV DB_USER=root
ENV DB_PASSWORD=password
ENV DB_NAME=battleship
CMD ["npm", "run", "prod"]

@ -1,30 +1,26 @@
version: '3'
services:
app:
build:
context: .
dockerfile: Dockerfile
ports:
- "8080:8080"
- "3000:3000"
volumes:
- .:/usr/src/app
- /usr/src/app/node_modules
environment:
- NODE_ENV=production
- DB_HOST=db
- DB_USER=root
- DB_PASSWORD=password
- DB_NAME=myapp
- DB_NAME=battleship
depends_on:
- db
db:
platform: linux/x86_64
image: mysql:5.7
image: mysql:8.0
restart: always
environment:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: myapp
ports:
- "3306:3306"
volumes:

@ -2,7 +2,7 @@ const express = require("express");
const app = express();
const http = require("http").Server(app);
const io = require("socket.io")(http);
const port = 8080;
const port = 3000;
const db = require("./database.js")
const jwt = require('jsonwebtoken');
const cookieParser = require('cookie-parser');

@ -4,6 +4,7 @@
"description": "Simple online battleship game that I design for mae when lectures are boring",
"main": "index.js",
"scripts": {
"prod": "node index.js",
"dev": "nodemon --env-file=.env index.js",
"start": "node --env-file=.env index.js"
},

Loading…
Cancel
Save