Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
10 changes: 10 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
NODE_ENV=production
VITE_MODE=production

APP_PORT=8181

VITE_API_BASE_URL=http://127.0.0.1:4242

VITE_KEYCLOAK_URL=http://localhost:8080/
VITE_KEYCLOAK_REALM=dev
VITE_KEYCLOAK_CLIENT_ID=bff-dashboard
2 changes: 1 addition & 1 deletion .env.production
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VITE_API_BASE_URL=http://127.0.0.1:3338

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ coverage/
tsconfig.app.tsbuildinfo
tsconfig.node.tsbuildinfo
*storybook.log
.env
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# 0.1.0

* Initial version
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ARG NODE_ENV
ARG VITE_MODE

FROM node:22.11.0-slim@sha256:f035ba7ffee18f67200e2eb8018e0f13c954ec16338f264940f701997e3c12da AS builder
FROM node:24.2.0-slim AS builder

Choose a reason for hiding this comment

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

Suggestion: Pin Docker image digest

Suggested change
FROM node:24.2.0-slim AS builder
FROM node:24.2.0-slim@sha256:[specific-sha256-hash] AS builder

ARG NODE_ENV
ARG VITE_MODE
ENV NODE_ENV=${NODE_ENV:-production}
Expand All @@ -11,13 +11,13 @@ WORKDIR /app

COPY package*.json ./

RUN npm install --no-fund --no-audit
RUN npm install --no-fund --no-audit --include=dev

COPY . .

RUN npm run build -- --mode=${VITE_MODE}

FROM nginx:1.27.4-alpine@sha256:4ff102c5d78d254a6f0da062b3cf39eaf07f01eec0927fd21e219d0af8bc0591
FROM nginx:1.27.5-alpine

COPY --from=builder /app/dist /usr/share/nginx/html

Expand Down
20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,35 @@
npm install
```

### Run
### Run Development
```
npm run dev
```

### Run Docker
Copy `.env.example` to `.env` and adjust
```
just build
just run
```

### shadcn
Add a shadcn component:
```shell
npx shadcn@canary add button
```

## Configuration
`VITE_API_BASE_URL="http://localhost:4242"` needs to point to the Wildcat BFF Dashboard Envoy Service

```
VITE_KEYCLOAK_URL=http://localhost:8080/
VITE_KEYCLOAK_REALM=dev
VITE_KEYCLOAK_CLIENT_ID=bff-dashboard
```

These are the keycloak url and realm settings for the JWT tokens authenticated by the Wildcat Dashboard Envoy service.

## Resources

- React: https://react.dev/
Expand Down
21 changes: 18 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@

services:
app:
build: .
build:
context: .
args:
NODE_ENV: ${NODE_ENV}
VITE_MODE: ${VITE_MODE}
ports:
- "8080:80"
- "${APP_PORT}:80"
restart: unless-stopped
environment:
- VITE_API_BASE_URL=${VITE_API_BASE_URL}
- VITE_KEYCLOAK_URL=${VITE_KEYCLOAK_URL}
- VITE_KEYCLOAK_REALM=${VITE_KEYCLOAK_REALM}
- VITE_KEYCLOAK_CLIENT_ID=${VITE_KEYCLOAK_CLIENT_ID}
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:80"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
23 changes: 23 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

# print available targets
[group("project-agnostic")]
default:
@just --list --justfile {{justfile()}}

# evaluate and print all just variables
[group("project-agnostic")]
evaluate:
@just --evaluate

# print system information such as OS and architecture
[group("project-agnostic")]
system-info:
@echo "architecture: {{arch()}}"
@echo "os: {{os()}}"
@echo "os family: {{os_family()}}"

build:
docker build -t wildcat/dashboard -f Dockerfile .

run:
docker compose up
Loading