Compare commits

..

2 Commits

Author SHA1 Message Date
4c190dd1bb chore: update readme 2025-02-20 14:12:17 +00:00
225864d8fa chore: consolidate commands into Dockerfile 2025-02-20 14:11:55 +00:00
4 changed files with 4 additions and 21 deletions

View File

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

View File

@@ -11,7 +11,7 @@ To use this container, run the supplied `docker-compose.yml` and substitute the
Create your first repository against the container using: Create your first repository against the container using:
``` ```
borg init -e repokey borg@<containter ip>:/opt/borg/<repository name> borg init -e repokey borg@[IP]:/opt/borg/<repository name>
``` ```
If you have selected another port other than 22, you can change the port used by borg by running `export BORG_RSH="ssh -p <port>"` on the client running the backup command. If you have selected another port other than 22, you can change the port used by borg by running `export BORG_RSH="ssh -p <port>"` on the client running the backup command.

View File

@@ -1,14 +1,10 @@
services: services:
borg: borg:
image: ghcr.io/jordanwalster/borgbackup:latest image: git.jrdn.dev/jordanwalster/borgbackup:latest
ports: ports:
- 22:22 - 22:22
volumes: volumes:
- ./borg:/opt/borg - ./borg:/opt/borg
- ssh-keys:/home/borg/.ssh
environment: environment:
- SSH_PASSWORD=value - SSH_PASSWORD=value
restart: always restart: always
volumes:
ssh-keys:

View File

@@ -1,23 +1,8 @@
#!/bin/sh #!/bin/sh
# Create backup user
echo "Creating borg backup user"
adduser -D borg
# Set ssh password # Set ssh password
echo "Updating password..." echo "Updating password..."
echo "borg:$SSH_PASSWORD" | chpasswd 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 # Start SSHD
/usr/sbin/sshd -D /usr/sbin/sshd -D