Skip to content
This repository has been archived by the owner on Aug 30, 2024. It is now read-only.

Commit

Permalink
entrypoint for docker images to correctly create database files yk
Browse files Browse the repository at this point in the history
  • Loading branch information
alessiodam committed Jun 25, 2024
1 parent 8cb1e0d commit d08bd46
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ RUN apt-get update && apt-get upgrade -y && rm -rf /var/lib/apt/lists/*
COPY --from=builder /app/target/${TARGET}/release/netchat-server /usr/local/bin/netchat-server
COPY --from=builder /app/config.toml /app/config.toml

ENTRYPOINT ["netchat-server"]
ENTRYPOINT ["bash", "/app/entrypoint.sh"]
15 changes: 15 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh

if [ ! -f /app/netchat.db ]; then
touch /app/netchat.db
echo "Created netchat.db"
else
echo "netchat.db already exists"
fi

if [ ! -f /app/config.toml ]; then
cp /app/config.toml.example /app/config.toml
echo "Created config.toml from config.toml.example"
fi

exec netchat-server

0 comments on commit d08bd46

Please sign in to comment.