Fix Docker images

next
Sayan Nandan 10 months ago
parent 179fb09544
commit 6904224eb1
No known key found for this signature in database
GPG Key ID: 42EEDF4AE9D96B54

@ -4,4 +4,5 @@
# Only include the skyd binary
!target/release/skyd
!target/release/skysh
!examples/config-files/docker.toml
!examples/config-files/dpkg/config.yaml
!pkg/docker/start-server.sh

@ -2,11 +2,8 @@ name: Docker image
on:
push:
# Publish `next` as Docker `latest` image.
branches:
- next
# Publish `v1.2.3` tags as releases.
tags:
- v*
@ -34,14 +31,16 @@ jobs:
command: build
args: --release
- name: Build image
run: docker build . --file Dockerfile --tag $IMAGE_NAME
if: env.BUILD == 'true' || github.event_name == 'create' && startsWith(github.ref, 'refs/tags/v')
run: docker build . --file Dockerfile --tag $IMAGE_NAME:${{ github.ref == 'refs/heads/next' && 'next' || github.ref_name }}
if: github.ref == 'refs/heads/next' || startsWith(github.ref, 'refs/tags/v')
- name: Push to Docker Hub
uses: docker/build-push-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: skytable/sdb
tags: latest
tag_with_ref: true
if: env.BUILD == 'true' || github.event_name == 'create' && startsWith(github.ref, 'refs/tags/v')
repository: skytable/skytable
tags: |
${{ github.ref == 'refs/heads/next' && 'next' || '' }}
${{ startsWith(github.ref, 'refs/tags/v') && github.ref_name || '' }}
${{ startsWith(github.ref, 'refs/tags/v') && 'latest' || '' }}
if: github.ref == 'refs/heads/next' || startsWith(github.ref, 'refs/tags/v')

@ -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…
Cancel
Save