Move docker to top level, include frontend
This commit is contained in:
parent
955966e56e
commit
1ab51fa578
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
local
|
|
@ -1,11 +1,11 @@
|
||||||
FROM node:14
|
FROM node:14
|
||||||
|
|
||||||
WORKDIR /opt/obsAPI
|
WORKDIR /opt/obs/api
|
||||||
ADD package.json package-lock.json /opt/obsAPI/
|
ADD package.json package-lock.json /opt/obs/api/
|
||||||
RUN npm ci
|
RUN npm ci
|
||||||
|
|
||||||
ADD src /opt/obsAPI/src/
|
ADD src /opt/obs/api/src/
|
||||||
|
|
||||||
EXPOSE 8080
|
EXPOSE 3000
|
||||||
ENV PORT=8080
|
ENV PORT=3000
|
||||||
CMD ["npm", "start"]
|
CMD ["npm", "start"]
|
||||||
|
|
|
@ -1,35 +0,0 @@
|
||||||
version: '3'
|
|
||||||
|
|
||||||
services:
|
|
||||||
mongo:
|
|
||||||
image: mongo
|
|
||||||
tty: true
|
|
||||||
volumes:
|
|
||||||
- ./local/mongo:/data/db
|
|
||||||
ports:
|
|
||||||
- '27017:27017'
|
|
||||||
restart: on-failure
|
|
||||||
|
|
||||||
api:
|
|
||||||
image: obs-api
|
|
||||||
build:
|
|
||||||
context: .
|
|
||||||
dockerfile: ./Dockerfile
|
|
||||||
volumes:
|
|
||||||
- ./src:/opt/obsAPI/src
|
|
||||||
- ./local/api-data:/data
|
|
||||||
- .migrations.js:/opt/obsAPI/.migrations.js
|
|
||||||
- ./migrations:/opt/obsAPI/migrations/
|
|
||||||
environment:
|
|
||||||
- PORT=3000
|
|
||||||
- MONGODB_URL=mongodb://mongo/obsTest
|
|
||||||
- DATA_DIR=/data
|
|
||||||
links:
|
|
||||||
- mongo
|
|
||||||
ports:
|
|
||||||
- '3000:3000'
|
|
||||||
restart: on-failure
|
|
||||||
command:
|
|
||||||
- npm
|
|
||||||
- run
|
|
||||||
- dev
|
|
54
docker-compose.yaml
Normal file
54
docker-compose.yaml
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
version: '3'
|
||||||
|
|
||||||
|
services:
|
||||||
|
mongo:
|
||||||
|
image: mongo
|
||||||
|
tty: true
|
||||||
|
volumes:
|
||||||
|
- ./local/mongo:/data/db
|
||||||
|
ports:
|
||||||
|
- '27017:27017'
|
||||||
|
restart: on-failure
|
||||||
|
|
||||||
|
api:
|
||||||
|
image: obs-api
|
||||||
|
build:
|
||||||
|
context: ./api
|
||||||
|
volumes:
|
||||||
|
- ./api/src:/opt/obs/api/src
|
||||||
|
- ./local/api-data:/data
|
||||||
|
- ./api/.migrations.js:/opt/obs/api/.migrations.js
|
||||||
|
- ./api/migrations:/opt/obs/api/migrations/
|
||||||
|
environment:
|
||||||
|
- PORT=3000
|
||||||
|
- MONGODB_URL=mongodb://mongo/obsTest
|
||||||
|
- DATA_DIR=/data
|
||||||
|
links:
|
||||||
|
- mongo
|
||||||
|
ports:
|
||||||
|
- '3000:3000'
|
||||||
|
restart: on-failure
|
||||||
|
command:
|
||||||
|
- npm
|
||||||
|
- run
|
||||||
|
- dev
|
||||||
|
|
||||||
|
frontend:
|
||||||
|
image: obs-frontend
|
||||||
|
build:
|
||||||
|
context: ./frontend
|
||||||
|
volumes:
|
||||||
|
- ./frontend/src:/opt/obs/frontend/src
|
||||||
|
- ./frontend/public:/opt/obs/frontend/public
|
||||||
|
- ./frontend/tsconfig.json:/opt/obs/frontend/tsconfig.json
|
||||||
|
- ./frontend/package.json:/opt/obs/frontend/package.json
|
||||||
|
environment:
|
||||||
|
- PORT=3000
|
||||||
|
links:
|
||||||
|
- api
|
||||||
|
ports:
|
||||||
|
- '3001:3000'
|
||||||
|
restart: on-failure
|
||||||
|
command:
|
||||||
|
- npm
|
||||||
|
- start
|
9
frontend/Dockerfile
Normal file
9
frontend/Dockerfile
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
FROM node:14
|
||||||
|
|
||||||
|
WORKDIR /opt/obs/frontend
|
||||||
|
ADD package.json package-lock.json /opt/obs/frontend/
|
||||||
|
RUN npm ci
|
||||||
|
|
||||||
|
ADD tsconfig.json /opt/obs/frontend
|
||||||
|
ADD public/ /opt/obs/frontend/public/
|
||||||
|
ADD src/ /opt/obs/frontend/src/
|
|
@ -30,7 +30,7 @@
|
||||||
"web-vitals": "^0.2.4"
|
"web-vitals": "^0.2.4"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "PORT=3001 react-scripts start",
|
"start": "react-scripts start",
|
||||||
"build": "react-scripts build",
|
"build": "react-scripts build",
|
||||||
"test": "react-scripts test",
|
"test": "react-scripts test",
|
||||||
"eject": "react-scripts eject"
|
"eject": "react-scripts eject"
|
||||||
|
@ -53,8 +53,7 @@
|
||||||
"last 1 safari version"
|
"last 1 safari version"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"proxy": "http://localhost:3000",
|
"proxy": "http://api:3000",
|
||||||
"port": 3001,
|
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/lodash": "^4.14.168",
|
"@types/lodash": "^4.14.168",
|
||||||
"@types/react-redux": "^7.1.16",
|
"@types/react-redux": "^7.1.16",
|
||||||
|
|
Loading…
Reference in a new issue