Skip to content

Commit

Permalink
fix(status): shuffling works; slim down Docker image considerably
Browse files Browse the repository at this point in the history
  • Loading branch information
dr460nf1r3 committed Oct 6, 2024
1 parent f71b3ae commit eda2a9d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,19 @@ RUN corepack enable && corepack prepare pnpm@latest --activate
# Workaround for nx post-install hanging
RUN pnpm install --ignore-scripts nx
RUN pnpm install
RUN pnpx nx reset
RUN pnpx nx run backend:build

# Generate node_modules containing nx-generated package.json for less used space
WORKDIR /build/dist/backend
RUN pnpm install --prod

FROM node:22-bookworm-slim

# Copy the compiled backend and the entry point script in a clean image
WORKDIR /app
COPY entry_point.sh /entry_point.sh
RUN chmod +x /entry_point.sh
COPY --from=builder /build/dist/backend /app
COPY --from=builder /build/node_modules /app/node_modules

EXPOSE 3000
VOLUME ["/app/tdlib"]
Expand Down
17 changes: 13 additions & 4 deletions frontend/src/app/status/status.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,21 +156,28 @@ export class StatusComponent implements AfterViewInit {
timeZone: "UTC"
})

// Check if there is nothing going on
this.nothingGoingOn = returnQueue.findIndex((queue) => queue.status !== "idle" && queue.count > 0) === -1

// Check if there is a live log to display and handle changes accordingly
if (!this.nothingGoingOn) {
const activeQueue = returnQueue.find((queue) => queue.status === "active")
if (this.liveLog !== activeQueue!.liveLogUrl![0] && this.currentBuild === 0) {
const savedLog = localStorage.getItem("currentBuild")

if (savedLog !== null && activeQueue!.liveLogUrl![Number(savedLog)] !== undefined && this.liveLog !== activeQueue!.liveLogUrl![Number(savedLog)]) {
this.liveLog = activeQueue!.liveLogUrl![Number(savedLog)]
} else if (activeQueue!.liveLogUrl![0] !== undefined) {
this.liveLog = activeQueue!.liveLogUrl![0]
this.currentBuild = 0
localStorage.setItem("currentBuild", this.currentBuild.toString())
}
this.activeBuilds = activeQueue!.liveLogUrl!.length
} else {
this.liveLog = undefined
}

this.cdr.detectChanges()

this.currentQueue = returnQueue
this.cdr.detectChanges()
this.loading = false
})
.catch((err) => {
Expand Down Expand Up @@ -224,12 +231,14 @@ export class StatusComponent implements AfterViewInit {
const activeQueue = this.currentQueue.find((queue) => queue.status === "active")
if (!activeQueue) return

if ((this.currentBuild + 1) <= this.activeBuilds) {
if ((this.currentBuild + 2) <= this.activeBuilds) {
this.currentBuild++
this.liveLog = activeQueue.liveLogUrl![this.currentBuild]
localStorage.setItem("currentBuild", this.currentBuild.toString())
} else {
this.currentBuild = 0
this.liveLog = activeQueue.liveLogUrl![0]
localStorage.setItem("currentBuild", this.currentBuild.toString())
}
}
}

0 comments on commit eda2a9d

Please sign in to comment.