Skip to content

Commit a58c806

Browse files
author
Isaac Cruz
committed
Docker Dev Integration
1 parent 8f37d3c commit a58c806

File tree

3 files changed

+51
-0
lines changed

3 files changed

+51
-0
lines changed

.dockerignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules
2+
.dockerignore
3+
Dockerfile-dev

Dockerfile-dev

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
FROM node:latest
2+
3+
# set working directory
4+
RUN mkdir /usr/src/app
5+
WORKDIR /usr/src
6+
7+
# install and cache app dependencies
8+
ADD package.json /usr/src/app/package.json
9+
RUN npm install
10+
11+
# add `/usr/src/node_modules/.bin` to $PATH
12+
ENV PATH /usr/src/node_modules/.bin:$PATH
13+
14+
# add app
15+
COPY . /usr/src/app
16+
17+
# start app
18+
CMD ["npm", "run", "dev]

docker-compose-dev.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
version: "2.1"
2+
3+
services:
4+
app-db-dev:
5+
container_name: app-db
6+
image: mongo
7+
ports:
8+
- "27017:27017"
9+
healthcheck:
10+
test: exit 0
11+
12+
app-service-dev:
13+
container_name: app
14+
build:
15+
context: ./
16+
dockerfile: Dockerfile-dev
17+
volumes:
18+
- "./:/usr/src/app"
19+
- "./package.json:/usr/src/package.json"
20+
ports:
21+
- "3000:3000"
22+
environment:
23+
- MONGO_URL="mongodb://app-db:27017/SampleDB"
24+
- MONGO_URL_TEST="mongodb://app-db:27017/SampleDB"
25+
- SESSION_SECRET="xxxxxxx"
26+
links:
27+
- app-db-dev
28+
depends_on:
29+
app-db-dev:
30+
condition: service_healthy

0 commit comments

Comments
 (0)