update dockerfile and start script.
continuous-integration/drone/tag Build is passing

This commit is contained in:
victor.kolomin committed 2025-10-02 10:00:21 +02:00
1 parent 2c0beed5a7
commit e83d8008bb
2 files changed
+8 -23

No files matched your search

+4 -8
View File
@@ -3,7 +3,7 @@ FROM rust:bookworm AS builder
WORKDIR /app
# Установим зависимости для сборки
# Setup necessary dependencies for building rustic with opendal backend
RUN apt-get update && apt-get install -y --no-install-recommends \
pkg-config \
libssl-dev \
@@ -20,14 +20,10 @@ RUN cargo install --locked \
# Stage 2: runtime
FROM debian:bookworm-slim
# Установим только минимальный набор пакетов для запуска
# Install runtime dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
bash \
curl \
cron \
tzdata \
&& rm -rf /var/lib/apt/lists/*
cron bash curl tzdata ca-certificates && \
rm -rf /var/lib/apt/lists/*
COPY --from=builder /usr/local/cargo/bin/rustic /usr/local/bin/rustic
+4 -15
View File
@@ -19,23 +19,12 @@ CRONTAB_FILE="/var/spool/cron/crontabs/root"
echo "Creating crontab entry: ${CRON_SCHEDULE} /usr/local/bin/backup.sh"
# Note: The absolute path to the script is required by cron.
echo "${CRON_SCHEDULE} /usr/local/bin/backup.sh >> /var/log/cron.log 2>&1" > ${CRONTAB_FILE}
echo "${CRON_SCHEDULE} /usr/local/bin/backup.sh" > ${CRONTAB_FILE}
# Ensure the crontab file has the correct permissions (not strictly needed for root, but good practice)
chmod 600 ${CRONTAB_FILE}
# --- 3. Start Daemon ---
echo "Starting cron daemon (crond -l 8)..."
# Start crond with a log level of 8 (verbose)
/usr/sbin/crond -l 8
echo "Cron daemon is running. Container is now in daemon mode."
# --- 4. Keep Container Running ---
# The container must not exit, so we run a never-ending loop (the main process).
# This keeps the container alive so crond can execute its tasks.
while true
do
# Sleep for a long time (1 hour)
sleep 3600
done
echo "Starting cron daemon in foreground..."
exec /usr/sbin/cron -f -L 8
echo "Cron daemon is running. Container is now in daemon mode."