feat: Update Dockerfile and scripts for improved build process and cron job functionality

This commit is contained in:
imnyang 2025-05-20 06:09:16 +09:00
commit ef65994a82
5 changed files with 115 additions and 58 deletions

View file

@ -1,12 +1,6 @@
FROM oven/bun:alpine
FROM oven/bun:alpine as build
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
@ -19,11 +13,38 @@ RUN mkdir -p /code/app/temp
# Install dependencies
RUN bun install
# Build the project
RUN bun build index.ts --compile --minify --outfile ./run
FROM oven/bun:alpine as runner
LABEL maintainer="@imnya"
# Set the working directory
WORKDIR /code
RUN mkdir -p /code/app
# Copy the built files from the build stage
COPY --from=build /code/app/run /code/app/run
COPY --from=build /code/app/template /code/app/template
COPY --from=build /code/app/.env /code/app/.env
COPY --from=build /code/app/cron /code/app/cron
COPY --from=build /code/app/run.sh /code/app/run.sh
RUN mkdir -p /code/app/temp
# 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
# Cron job
RUN apk add --no-cache curl
RUN curl -Lo /code/app/supercronic https://github.com/aptible/supercronic/releases/latest/download/supercronic-linux-amd64 \
&& chmod +x /code/app/supercronic
RUN curl -o /code/app/temp/vts.xlsx https://f.imnya.ng/.today.isangjeong/vts.xlsx
COPY cron /code/app/cron
RUN chmod +x /code/app/cron