-
Notifications
You must be signed in to change notification settings - Fork 6
/
Dockerfile
43 lines (33 loc) · 1.49 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
FROM ubuntu:latest
FROM mongo:3.4
# Create app directory
RUN mkdir -p /usr/src/byo-cat2
WORKDIR /usr/src/byo-cat2/frame-server
#Install npm
RUN apt-get update
RUN apt-get install -y nodejs
RUN apt-get install -y npm
RUN npm cache clean -f
RUN apt-get install -y curl #Needed for the 'n' package to be installed successfully.
RUN npm install -g n
#Can change this to install particular version of node as well - 6.3.0
RUN n lts
RUN apt-get install -y netcat #Pings to verify if mongo container is up and running, node fails if mongo is down.
# Copy app source and data
COPY . /usr/src/byo-cat2/
RUN apt-get install -y mongodb #Needed to seed data to mongo container
# symlink to node_module is not to be used. This occurs because of we are mounting this folder so that we can work in live environment
RUN if [ -L "/usr/src/byo-cat2/frame-server/node_modules" ]; then rm /usr/src/byo-cat2/frame-server/node_modules; echo "npm-modules symlink is removed" ; fi;
# this removes npm_module directory. To install docker compatible modules
RUN if [ -d "/usr/src/byo-cat2/frame-server/node_modules" ]; then rm -rf /usr/src/byo-cat2/frame-server/node_modules; echo "npm-modules directory is removed" ; fi;
# Install app dependencies
RUN npm install
RUN npm install nodemon --save
ENV NODE_ENV 'docker'
# Setup app
RUN nodejs -v
RUN ln -s /usr/bin/nodejs /usr/bin/node
RUN node -v
EXPOSE 9000
EXPOSE 8000
CMD sh docker-run.sh