Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,7 @@ static/*.db-wal

.secrets
.env

web/dist/
web/node_modules/
web/.astro/
12 changes: 11 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,21 @@ WORKDIR /app
COPY . .
RUN go build -o reverse-watch main.go

# Build the Astro dashboard to web/dist. `npm ci` installs from the
# committed package-lock.json for reproducible, supply-chain-pinned deps.
FROM node:22 AS web-builder

WORKDIR /app/web
COPY web/package.json web/package-lock.json ./
RUN npm ci
COPY web/ ./
RUN npm run build

FROM gcr.io/distroless/base-debian12

WORKDIR /app
COPY --from=builder /app/reverse-watch /app/reverse-watch
COPY --from=builder /app/static/index.html /app/static/index.html
COPY --from=web-builder /app/web/dist /app/web/dist

EXPOSE 80
CMD ["./reverse-watch"]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# [reverse.watch](https://reverse.watch)

Community-driven open trade reversal tracking database for Steam. Participating entities can report trade reverals to the open database.
Community-driven open trade reversal tracking database for Steam. Participating entities can report trade reversals to the open database.

## Interested in Participating?

Expand Down
10 changes: 9 additions & 1 deletion server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,16 @@ func New(cfg config.Config, factory repository.Factory) (*Server, error) {

r.Use(rwmiddleware.FactoryMiddleware(factory))

// Serve the Astro-built dashboard from web/dist. `npm run build`
// emits the hashed bundles under web/dist/_astro and copies
// public/static verbatim to web/dist/static, so we hand both
// prefixes to a single FileServer and fall back to index.html for
// the root document.
fs := http.FileServer(http.Dir("web/dist"))
r.Handle("/static/*", fs)
r.Handle("/_astro/*", fs)
r.Get("/", func(w http.ResponseWriter, r *http.Request) {
http.ServeFile(w, r, "static/index.html")
http.ServeFile(w, r, "web/dist/index.html")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Homepage missing without web build

High Severity

The root route now serves web/dist/index.html, but web/dist/ is a gitignored build output. This means the dashboard at / will be missing for local development and deployments that don't include the web build step.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 8a04e6b. Configure here.

})

r.Mount("/api", api.Router())
Expand Down
Loading
Loading