Skip to content

Commit

Permalink
Update dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
hvpulok committed Jul 1, 2018
1 parent 32d2e10 commit 0c0448a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 56 deletions.
70 changes: 15 additions & 55 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,62 +1,22 @@
# Build:
# docker build -t meanjs/mean .
#
# Run:
# docker run -it meanjs/mean
#
# Compose:
# docker-compose up -d
# Create image based on the official Node 6 image from the dockerhub
FROM node:8.11.3

FROM ubuntu:latest
MAINTAINER MEAN.JS
# Create a directory where our app will be placed
RUN mkdir -p /usr/src/app

# 80 = HTTP, 443 = HTTPS, 3000 = MEAN.JS server, 35729 = livereload, 8080 = node-inspector
EXPOSE 80 443 3000 35729 8080
# Change directory so that our commands run inside this new directory
WORKDIR /usr/src/app

# Set development environment as default
ENV NODE_ENV development

# Install Utilities
RUN apt-get update -q \
&& apt-get install -yqq \
curl \
git \
ssh \
gcc \
make \
build-essential \
libkrb5-dev \
sudo \
apt-utils \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Get all the code needed to run the app
COPY . .

# Install nodejs
RUN curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
RUN sudo apt-get install -yq nodejs \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Install dependecies
RUN npm install

# Install MEAN.JS Prerequisites
RUN npm install --quiet -g gulp bower yo mocha karma-cli pm2 && npm cache clean
# Expose the port the app runs in
EXPOSE 8443
EXPOSE 8080

RUN mkdir -p /opt/mean.js/public/lib
WORKDIR /opt/mean.js

# Copies the local package.json file to the container
# and utilities docker container cache to not needing to rebuild
# and install node_modules/ everytime we build the docker, but only
# when the local package.json file changes.
# Install npm packages
COPY package.json /opt/mean.js/package.json
RUN npm install --quiet && npm cache clean

# Install bower packages
COPY bower.json /opt/mean.js/bower.json
COPY .bowerrc /opt/mean.js/.bowerrc
RUN bower install --quiet --allow-root --config.interactive=false

COPY . /opt/mean.js

# Run MEAN.JS server
CMD npm install && npm start
# Serve the app
CMD ["npm", "start"]
2 changes: 1 addition & 1 deletion config/env/production.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module.exports = {
port: process.env.PORT || 8080,
securePort: process.env.SPORT || 8443,
// Binding to 127.0.0.1 is safer in production.
host: process.env.HOST || '127.0.0.1',
host: process.env.HOST || '0.0.0.0',
db: {
uri: process.env.MONGOHQ_URL || process.env.MONGODB_URI || 'mongodb://' + (process.env.DB_1_PORT_27017_TCP_ADDR || 'localhost') + '/mean',
options: {
Expand Down

0 comments on commit 0c0448a

Please sign in to comment.