Fix Docker images
parent
179fb09544
commit
6904224eb1
@ -1,14 +1,16 @@
|
||||
#
|
||||
# The Dockerfile for the Skytable server sdb
|
||||
#
|
||||
|
||||
FROM debian:stable
|
||||
|
||||
# Copy the necessary binaries
|
||||
COPY target/release/skyd /usr/local/bin
|
||||
COPY target/release/skysh /usr/local/bin
|
||||
RUN mkdir /etc/skytable
|
||||
# Create necessary directories
|
||||
RUN mkdir /var/lib/skytable
|
||||
COPY examples/config-files/docker.toml /etc/skytable/skyd.toml
|
||||
COPY examples/config-files/dpkg/config.yaml /var/lib/skytable/config.yaml
|
||||
COPY pkg/docker/start-server.sh /usr/local/bin/start-server.sh
|
||||
WORKDIR /var/lib/skytable
|
||||
CMD ["skyd", "-c", "/etc/skytable/skyd.toml"]
|
||||
# Install uuidgen for generating a random password
|
||||
RUN apt-get update && apt-get install -y uuid-runtime
|
||||
RUN chmod +x /usr/local/bin/start-server.sh
|
||||
ENTRYPOINT ["/usr/local/bin/start-server.sh"]
|
||||
EXPOSE 2003/tcp
|
||||
|
@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
|
||||
CONFIG_FILE="/var/lib/skytable/config.yaml"
|
||||
PASSWORD_MARKER="rootpass"
|
||||
IP_MARKER="127.0.0.1"
|
||||
|
||||
generate_password() {
|
||||
uuidgen | cut -c -16
|
||||
}
|
||||
|
||||
sed -i "s/$IP_MARKER/0.0.0.0/g" "$CONFIG_FILE"
|
||||
|
||||
if grep -q "$PASSWORD_MARKER" "$CONFIG_FILE"; then
|
||||
# Password not set, generate a new one
|
||||
PASSWORD=$(generate_password)
|
||||
sed -i "s/$PASSWORD_MARKER/$PASSWORD/g" "$CONFIG_FILE"
|
||||
echo "Generated Password: $PASSWORD"
|
||||
else
|
||||
echo "Using existing password in config file"
|
||||
fi
|
||||
|
||||
exec skyd --config "$CONFIG_FILE"
|
Loading…
Reference in New Issue