Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added signal handler & listen on all interfaces to be accessible from outside #12

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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