From d8f12f1780bf32128272875b3305add7e7f7751c Mon Sep 17 00:00:00 2001 From: Mauricio Siu <47042324+Siumauricio@users.noreply.github.com> Date: Sun, 4 May 2025 22:19:24 -0600 Subject: [PATCH] Update Dockerfile to include rsync and refactor backup command in web-server.ts - Added `rsync` to the Dockerfile for improved file synchronization capabilities. - Refactored the backup command in `web-server.ts` to use `rsync` instead of `cp`, enhancing error handling and performance during filesystem copying. --- Dockerfile | 2 +- packages/server/src/utils/backups/web-server.ts | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index a9b5f9517..1e104eebc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -29,7 +29,7 @@ WORKDIR /app # Set production ENV NODE_ENV=production -RUN apt-get update && apt-get install -y curl unzip zip apache2-utils iproute2 && rm -rf /var/lib/apt/lists/* +RUN apt-get update && apt-get install -y curl unzip zip apache2-utils iproute2 rsync && rm -rf /var/lib/apt/lists/* # Copy only the necessary files COPY --from=build /prod/dokploy/.next ./.next diff --git a/packages/server/src/utils/backups/web-server.ts b/packages/server/src/utils/backups/web-server.ts index 733d6a594..71df47ba6 100644 --- a/packages/server/src/utils/backups/web-server.ts +++ b/packages/server/src/utils/backups/web-server.ts @@ -56,7 +56,9 @@ export const runWebServerBackup = async (backup: BackupSchedule) => { writeStream.write(`Running command: ${postgresCommand}\n`); await execAsync(postgresCommand); - await execAsync(`cp -r ${BASE_PATH}/* ${tempDir}/filesystem/`); + await execAsync( + `rsync -av --ignore-errors ${BASE_PATH}/ ${tempDir}/filesystem/`, + ); writeStream.write("Copied filesystem to temp directory\n");