feat: add database migration CLI and entrypoint script

- Introduced a new entrypoint script to handle database migrations before starting the application.
- Implemented CLI commands for database migration, including argument parsing and execution logic.
- Updated Dockerfile to copy the entrypoint script and set it as the container's entrypoint.

Signed-off-by: Innei <tukon479@gmail.com>
This commit is contained in:
Innei
2025-11-11 17:53:23 +08:00
parent f4f66810c1
commit 7eebdb6083
4 changed files with 74 additions and 0 deletions

View File

@@ -32,6 +32,9 @@ WORKDIR /app
RUN apk add --no-cache perl
COPY --from=builder /workspace/be/apps/core/dist ./dist
COPY --from=builder /workspace/be/packages/db/migrations ./migrations
COPY --from=builder /workspace/be/apps/core/docker-entrypoint.sh ./docker-entrypoint.sh
RUN chmod +x ./docker-entrypoint.sh
RUN if [ -f dist/package.json ]; then \
cd dist && \
@@ -40,4 +43,5 @@ RUN if [ -f dist/package.json ]; then \
EXPOSE 1841
ENTRYPOINT ["./docker-entrypoint.sh"]
CMD ["node", "./dist/main.js"]