chore: consolidate commands into Dockerfile

This commit is contained in:
2025-02-20 14:17:53 +00:00
parent 398529e73b
commit 238c7c9bf8
3 changed files with 2 additions and 19 deletions

View File

@@ -8,6 +8,8 @@ RUN apk add borgbackup
# Create host keys to allow SSHD to start
RUN ssh-keygen -A
RUN adduser -D -h /opt/borg borg
COPY ./entrypoint.sh /entrypoint.sh
CMD ["/entrypoint.sh"]

View File

@@ -5,10 +5,6 @@ services:
- 22:22
volumes:
- ./borg:/opt/borg
- ssh-keys:/home/borg/.ssh
environment:
- SSH_PASSWORD=value
restart: always
volumes:
ssh-keys:

View File

@@ -1,23 +1,8 @@
#!/bin/sh
# Create backup user
echo "Creating borg backup user"
adduser -D borg
# Set ssh password
echo "Updating password..."
echo "borg:$SSH_PASSWORD" | chpasswd
# Change borg folder ownership to be owned by borg
echo "Setting file ownership"
chown -R borg:borg /opt/borg
# Create ssh directory and ensure permissions
mkdir /home/borg/.ssh
chown borg:borg /home/borg/.ssh
# Set default login path to /opt/borg
echo 'cd /opt/borg' >> /home/borg/.profile
# Start SSHD
/usr/sbin/sshd -D