diff --git a/Dockerfile b/Dockerfile index 70d5c27..3fe8bc1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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"] diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..f7bb2a6 --- /dev/null +++ b/entrypoint.sh @@ -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