forked from ExchangeBC/devex
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
81 lines (68 loc) · 2.15 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
FROM ubuntu:18.04
LABEL maintainer=MEAN.JS
# 80 = HTTP, 443 = HTTPS, 3000 = MEAN.JS server, 9229 = node debugger, 35729 = livereload
EXPOSE 80 443 3000 9229 35729
# Set development environment as default
ENV NODE_ENV development
# Install Utilities
RUN apt-get update -q \
&& apt-get install -yqq \
apt-utils \
curl \
wget \
aptitude \
htop \
vim \
git \
traceroute \
dnsutils \
ssh \
tree \
tcpdump \
nano \
psmisc \
gcc \
make \
build-essential \
libfreetype6 \
libfontconfig \
libkrb5-dev \
ruby \
sudo \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Install dumb-init
RUN wget https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb
RUN dpkg -i dumb-init_*.deb
# Install nodejs
RUN curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
RUN sudo DEBIAN_FRONTEND=noninteractive apt-get install -yq nodejs \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Install yarn (replaces npm)
RUN curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
RUN apt-get update -q \
&& sudo DEBIAN_FRONTEND=noninteractive apt-get install -yq yarn \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Install MEAN.JS Prerequisites
RUN yarn global add gulp yo mocha karma-cli gulp-if --silent \
&& yarn cache clean
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 yarn.lock /opt/mean.js/
# Install node_modules with yarn
RUN yarn install --non-interactive --pure-lockfile \
&& yarn cache clean
COPY . /opt/mean.js
# Do not fail when there is no build script
RUN npm run build --if-present
# Run MEAN.JS server
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
CMD ["npm", "start"]