Skip to content

Commit

Permalink
Make sure container exits when Core3 exec does
Browse files Browse the repository at this point in the history
  • Loading branch information
thmhoag committed Dec 23, 2019
1 parent 3a1a3e4 commit 14576a0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 14 deletions.
8 changes: 3 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
# needed by both builder and final
FROM ubuntu:16.04 as base-image

RUN apt-get update
RUN apt-get install -y build-essential \
RUN apt-get update && apt-get install -y build-essential \
libmysqlclient-dev \
liblua5.3-dev \
libdb5.3-dev \
libssl-dev

COPY scripts /app/scripts
RUN ln -s /app/scripts/swgemu.sh /usr/bin/swgemu

# Create builder image from base and add
# needed items for building the project
Expand Down Expand Up @@ -51,9 +52,6 @@ RUN chmod a+x /usr/bin/tini
WORKDIR /app/MMOCoreORB/bin
COPY --from=builder /app/MMOCoreORB/bin .

COPY scripts /app/scripts
RUN ln -s /app/scripts/swgemu.sh /usr/bin/swgemu

# tini is needed as core3 does not explicitly handle SIGTERM signals
ENTRYPOINT ["tini", "--"]
CMD ["swgemu", "start"]
13 changes: 4 additions & 9 deletions scripts/swgemu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,11 @@ server_start() {

trap 'graceful_shutdown;' SIGINT SIGTERM

(./core3 < /tmp/swgemu-input) &
echo "** core3 started **"

(sleep infinity > /tmp/swgemu-input) &
wait

# wait
# local core3pid=$!
# wait $core3pid
# sleep infinity
(./core3 < /tmp/swgemu-input) &
local core3pid=$!
echo "** core3 started (pid: $core3pid) **"
wait $core3pid
}

server_shutdown() {
Expand Down

0 comments on commit 14576a0

Please sign in to comment.