-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
executable file
·57 lines (46 loc) · 1.57 KB
/
Copy pathDockerfile
File metadata and controls
executable file
·57 lines (46 loc) · 1.57 KB
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
# Start with Ubuntu Trusty
FROM phusion/baseimage:0.10.0 AS BuildImage
# Use baseimage-docker's init system.
CMD ["/sbin/my_init"]
RUN apt-get update && apt-get install -y \
wget \
curl \
&& curl -sL https://deb.nodesource.com/setup_10.x | bash \
&& apt-get install -y \
nodejs \
git-core \
&& npm install yarn@1.9.4 -g \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Copy source files to container
COPY . /var/www/node
# Install all my packages, build and cleanup
RUN cd /var/www/node \
&& yarn install --force \
&& yarn build:tsoa \
&& yarn cache clean \
&& npm prune --production \
&& rm -rf node_modules/aws-sdk/dist/* \
&& rm -rf node_modules/aws-sdk/clients/* \
&& rm -rf node_modules/aws-sdk/apis/* \
&& rm -rf node_modules/sinon/pkg/*
FROM phusion/baseimage:0.10.0 as RunImage
# Use baseimage-docker's init system.
CMD ["/sbin/my_init"]
COPY --from=BuildImage /var/www/node /var/www/node
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash \
&& apt-get update && apt-get install -y nodejs \
&& npm install yarn@1.9.4 -g \
&& npm install pm2 -g --no-optional \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
&& chmod -R 777 var/www/node /var/log/ \
&& useradd -m node \
&& mkdir /var/log/nodejs \
&& chown -R node:node /var/www/node /var/log/ \
&& mkdir /etc/service/pm2 \
&& chmod -R 777 /etc/service/pm2
# Open local port 3030
EXPOSE 3030
ADD ./scripts/pm2.sh /etc/service/pm2/run
RUN chmod -R 777 /etc/service/pm2