fix: ensure dist files are cleared at container startup

This commit is contained in:
2026-05-13 14:12:02 +02:00
parent 3f6da13299
commit 00fb8b3b2f
2 changed files with 12 additions and 3 deletions

View File

@@ -23,7 +23,7 @@ RUN bun install --frozen-lockfile
# Copy all source files # Copy all source files
COPY . . COPY . .
# Build frontend assets (tailwind + ts) from a clean state # Ensure dist is clean at build time (belt + suspenders)
RUN rm -rf dist/ && bun run build:assets RUN rm -rf dist/ && bun run build:assets
# Generate sqlc code # Generate sqlc code
@@ -47,8 +47,8 @@ COPY --from=builder /app/templates ./templates
COPY --from=builder /app/static ./static COPY --from=builder /app/static ./static
COPY --from=builder /app/dist ./dist COPY --from=builder /app/dist ./dist
COPY --from=builder /app/internal/database/migrations ./migrations COPY --from=builder /app/internal/database/migrations ./migrations
COPY docker/entrypoint.sh ./entrypoint.sh
# Expose the application port
EXPOSE 3000 EXPOSE 3000
ENTRYPOINT ["./main_server"] ENTRYPOINT ["./entrypoint.sh"]

9
docker/entrypoint.sh Executable file
View File

@@ -0,0 +1,9 @@
#!/bin/sh
set -e
echo "[$(date -Iseconds)] Clearing dist/ directory..."
rm -rf /app/dist/*
echo "[$(date -Iseconds)] dist/ cleared"
echo "[$(date -Iseconds)] Starting server..."
exec /app/main_server