From 8399ce4107dc0f8c4d6e938a4ed2e34dd39afedd Mon Sep 17 00:00:00 2001 From: imnyang Date: Fri, 9 May 2025 20:16:59 +0900 Subject: [PATCH] =?UTF-8?q?Dockerfile=20=EB=B0=8F=20cron=20=ED=8C=8C?= =?UTF-8?q?=EC=9D=BC=20=EC=88=98=EC=A0=95:=20=ED=83=80=EC=9E=84=EC=A1=B4?= =?UTF-8?q?=20=EC=84=A4=EC=A0=95=20=EC=B6=94=EA=B0=80=20=EB=B0=8F=20cron?= =?UTF-8?q?=20=EB=A1=9C=EA=B7=B8=20=EC=B6=9C=EB=A0=A5=20=EA=B2=BD=EB=A1=9C?= =?UTF-8?q?=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 17 ++++++++++------- cron | 2 +- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3ee9e3d..77687b8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,12 @@ FROM oven/bun:alpine LABEL maintainer="@imnya" +# Set timezone to Asia/Seoul +RUN apk add --no-cache tzdata \ + && cp /usr/share/zoneinfo/Asia/Seoul /etc/localtime \ + && echo "Asia/Seoul" > /etc/timezone \ + && apk del tzdata + # Set the working directory COPY app /code/app COPY .env /code/app/.env @@ -13,13 +19,10 @@ RUN mkdir -p /code/app/temp # Install dependencies RUN bun install -# Run Cron job -RUN apk add dcron -RUN rc-update add dcron -RUN touch /var/log/cron.log -RUN service dcron start +# Cron job +RUN apk add --no-cache dcron bash # Copy the cron job file -COPY cron /etc/cron.d/cronjob +COPY cron /etc/crontabs/root -CMD [ "sleep", "infinity" ] \ No newline at end of file +CMD ["crond", "-f"] diff --git a/cron b/cron index 2026c3f..915d68e 100644 --- a/cron +++ b/cron @@ -1 +1 @@ -0 22 * * * /code/app/run.sh +0 22 * * * /code/app/run.sh >> /code/app/temp/run-$(date +%Y%m%d-%H%M%S).log 2>&1