diff --git a/Dockerfile b/Dockerfile index 5039c17..b11eda6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,7 +23,7 @@ RUN bun install --frozen-lockfile # Copy all source files 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 # Generate sqlc code @@ -47,8 +47,8 @@ COPY --from=builder /app/templates ./templates COPY --from=builder /app/static ./static COPY --from=builder /app/dist ./dist COPY --from=builder /app/internal/database/migrations ./migrations +COPY docker/entrypoint.sh ./entrypoint.sh -# Expose the application port EXPOSE 3000 -ENTRYPOINT ["./main_server"] +ENTRYPOINT ["./entrypoint.sh"] diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh new file mode 100755 index 0000000..616eb2e --- /dev/null +++ b/docker/entrypoint.sh @@ -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 \ No newline at end of file