Skip to content

Commit

Permalink
Dev (#20)
Browse files Browse the repository at this point in the history
* Typo fix

* Reduce docker image size
  • Loading branch information
Minituff authored Oct 12, 2023
1 parent 5904ef6 commit 9aea504
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 8 deletions.
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Use base docker image. Contains the docker commands we need to start and stop containers
FROM docker:24.0.6
FROM docker:24.0.6-cli

# Install dependencies
RUN apk add bash rsync tzdata
RUN apk add bash rsync tzdata dos2unix

# Copy all necessary files into the container (from /pkg in the repository to /app in the container)
COPY pkg app
Expand All @@ -11,10 +11,10 @@ COPY pkg app
RUN mv app/entry.sh /entry.sh

# Make the script executable
RUN chmod +x app/backup.sh
RUN chmod +x app/backup.sh && dos2unix app/backup.sh

# Make the entry script executable
RUN chmod +x entry.sh
RUN chmod +x entry.sh && dos2unix entry.sh

# Set default timezone
ENV TZ=Etc/UTC
Expand Down
2 changes: 1 addition & 1 deletion docs/advanced.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
These exmaples used Docker Compose syntax. See the [Installation section](./installation.md#docker-compose-example) to fit them into your configutation.
These exmaples used Docker Compose syntax. See the [Installation section](./installation.md#docker-compose-example) to fit them into your configuration.

## Alternative Source Directories
Don't have all your container volumes in the same directory? That's okay, we can use Docker volume mappings to help.
Expand Down
2 changes: 1 addition & 1 deletion docs/arguments.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Nautical provides configuration in the form of Docker enviornment variables.

See the [Installation Section](./installation.md), which contains a few examples of applying envrionment variables.
See the [Installation Section](./installation.md), which contains a few examples of applying enviornment variables.

## Time Zone

Expand Down
15 changes: 13 additions & 2 deletions pkg/backup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@ if [ "$REPORT_FILE" = "true" ]; then
fi


# Global variables to hold rsync arguments
custom_args=""
if [ ! -z "$RSYNC_CUSTOM_ARGS" ]; then
custom_args="$RSYNC_CUSTOM_ARGS"
fi


# Get arguments:
# -s = skips
# -d = override DEST_LOCATION
Expand Down Expand Up @@ -117,7 +124,9 @@ BackupContainer() {
fi

log_entry "Backing up $container data..."
rsync -ah -q --info=progress2 --exclude '*.log' $src_dir/ $dest_dir/
# rsync -ah -q --info=progress2 --exclude '*.log' $src_dir/ $dest_dir/
# echo rsync -ah -q $custom_args --info=progress2 $src_dir/ $dest_dir/
rsync -ah -q --info=progress2 $src_dir/ $dest_dir/ 2>&1 >/dev/null

if [ $? -ne 0 ]; then
log_entry "Error copying data for container $container. Skipping backup for this container."
Expand Down Expand Up @@ -168,4 +177,6 @@ for entry in $containers; do
fi
done

echo "Success. $containers_completed containers backed up!"
containers_skipped=$((number_of_containers - containers_completed))

echo "Success. $containers_completed containers backed up! $containers_skipped skipped."
8 changes: 8 additions & 0 deletions pkg/entry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,14 @@ if [ "$REPORT_FILE" = "false" ]; then
echo "REPORT_FILE: $REPORT_FILE"
fi

# Set rsync custom arguments if specified
if [ ! -z "$RSYNC_CUSTOM_ARGS" ]; then
echo "RSYNC_CUSTOM_ARGS: $RSYNC_CUSTOM_ARGS"
fi




if [ "$BACKUP_ON_START" = "true" ]; then
echo "BACKUP_ON_START: $BACKUP_ON_START"
bash ./app/backup.sh
Expand Down

0 comments on commit 9aea504

Please sign in to comment.