-
Notifications
You must be signed in to change notification settings - Fork 88
/
Dockerfile
42 lines (33 loc) · 1.32 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
FROM ubuntu:16.04
# add user group, user and make user home dir
RUN groupadd --gid 1000 easy-mock && \
useradd --uid 1000 --gid easy-mock --shell /bin/bash --create-home easy-mock
# set pwd to easy-mock home dir
WORKDIR /home/easy-mock
# install dependencies
RUN apt-get update && \
apt-get install --no-install-recommends -y \
build-essential \
python \
wget \
jq \
git \
apt-transport-https \
ca-certificates
# install nodejs
RUN wget http://cdn.npm.taobao.org/dist/node/v8.4.0/node-v8.4.0-linux-x64.tar.gz && \
tar -xzvf node-v8.4.0-linux-x64.tar.gz && \
ln -s /home/easy-mock/node-v8.4.0-linux-x64/bin/node /usr/local/bin/node && \
ln -s /home/easy-mock/node-v8.4.0-linux-x64/bin/npm /usr/local/bin/npm
# download easy-mock source code
USER easy-mock
RUN mkdir easy-mock && \
wget https://github.com/easy-mock/easy-mock/archive/v1.6.0.tar.gz && \
tar -xzvf v1.6.0.tar.gz -C easy-mock --strip-components 1
# npm install dependencies and run build
WORKDIR /home/easy-mock/easy-mock
RUN jq '.db = "mongodb://mongodb/easy-mock"' config/default.json > config/tmp.json && \
mv config/tmp.json config/default.json
RUN jq '.redis = { port: 6379, host: "redis" }' config/default.json > config/tmp.json && \
mv config/tmp.json config/default.json
RUN npm install && npm run build