Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,16 @@ RUN npm install -g json-server

WORKDIR /data
VOLUME /data
ENV PORT 8000

EXPOSE 80
# Expose ports
EXPOSE ${PORT}
ADD run.sh /run.sh
ENTRYPOINT ["bash", "/run.sh"]
CMD []

# adding tini bcz json server doesn't do error handling.
ENV TINI_VERSION v0.18.0
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini
RUN chmod +x /tini

ENTRYPOINT ["/tini", "-g", "--", "bash", "/run.sh"]
CMD []
4 changes: 2 additions & 2 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

args="$@"

args="$@ -p 80"
args="$@ -p $PORT --host 0.0.0.0"

file=/data/db.json
if [ -f $file ]; then
echo "Found db.json, trying to open"
args="$args db.json"
args="$args $file"
fi

file=/data/file.js
Expand Down