Skip to content

Commit

Permalink
Add dockerfile and dockercompose file
Browse files Browse the repository at this point in the history
- dockerfile will create a image
- dockercompose file aggregating all the services this
app needs such as- mongo, redis, my-reduxtagram(client)
  • Loading branch information
purnimagupta committed Oct 3, 2019
1 parent 63732f6 commit f6df223
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
lib
data
25 changes: 25 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
FROM node

# Create app directory
WORKDIR /usr/app

#Install app dependencies
# A wildcard is used to ensure both package.json and package-lock.json are copied where available (npm@5+)
COPY package*.json ./

#If you are building your code for production
#RUN npm install --only=production

RUN npm install

#Bundle app source

COPY . .

RUN npm run build

COPY .env ./lib/

EXPOSE 4000

CMD ["npm", "start"]
40 changes: 40 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
version: "3"
services:
reduxtagram-server:
container_name: reduxtagram-server-container
image: reduxtagram-server-image
restart: always
build: .
ports:
- "4000:4000"
environment:
- PORT=4000
- MONGOIP=mongo
- REDISIP=redis
depends_on:
- mongo
- redis
reduxtagram-client:
container_name: my-reduxtagram-container
image: my-reduxtagram-image
restart: always
build: .
ports:
- "3000:3000"

mongo:
container_name: mongo
restart: always
image: mongo
volumes:
- ./data/mongodb:/data/db
ports:
- "27017:27017"

redis:
container_name: redis
image: redis
volumes:
- ./data/redis:/data/db
ports:
- "6379:6379"

0 comments on commit f6df223

Please sign in to comment.