File tree Expand file tree Collapse file tree 2 files changed +42
-0
lines changed Expand file tree Collapse file tree 2 files changed +42
-0
lines changed Original file line number Diff line number Diff line change 1+ FROM node:latest
2+ MAINTAINER Francisco Guimarães <
[email protected] >
3+
4+ WORKDIR /app
5+
6+ ADD . /app
7+
8+ RUN npm run build && \
9+ ln -s /app/bin/index.js /usr/bin/json-server
10+
11+ WORKDIR /data
12+ VOLUME /data
13+
14+ EXPOSE 80
15+ ADD run.sh /run.sh
16+ ENTRYPOINT ["bash" , "/run.sh" ]
17+ CMD []
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ trap ' echo "Killing PID $SERVER_PID"; kill $SERVER_PID' EXIT
4+
5+
6+ args=" $@ "
7+
8+ args=" $@ -p 80"
9+
10+ file=/data/db.json
11+ if [ -f $file ]; then
12+ echo " Found db.json, trying to open"
13+ args=" $args db.json"
14+ fi
15+
16+ file=/data/file.js
17+ if [ -f $file ]; then
18+ echo " Found file.js seed file, trying to open"
19+ args=" $args file.js"
20+ fi
21+
22+ json-server $args &
23+ SERVER_PID=$!
24+ echo " json-server started with PID $SERVER_PID "
25+ wait
You can’t perform that action at this time.
0 commit comments