j
All checks were successful
Deploy Frontend / deploy (push) Successful in 4m3s

This commit is contained in:
Lee 2024-10-04 16:43:12 +01:00
parent 43cefc21aa
commit e0833d17f1
432 changed files with 9310 additions and 2898 deletions

3
.dockerignore Normal file

@ -0,0 +1,3 @@
node_modules
.next
.turbo

@ -1,3 +0,0 @@
{
"extends": ["next/core-web-vitals", "next/typescript"]
}

@ -1,21 +1,21 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: scoresaber-reloaded
name: scoresaber-reloaded-frontend
namespace: public-services
spec:
replicas: 1
selector:
matchLabels:
app: scoresaber-reloaded
app: scoresaber-reloaded-frontend
template:
metadata:
labels:
app: scoresaber-reloaded
app: scoresaber-reloaded-frontend
spec:
containers:
- name: scoresaber-reloaded-container
image: git.fascinated.cc/fascinated/scoresaber-reloaded:latest
- name: scoresaber-reloaded-frontend-container
image: git.fascinated.cc/fascinated/scoresaber-reloaded-frontend:latest
imagePullPolicy: Always
ports:
- containerPort: 3000

@ -2,7 +2,7 @@
apiVersion: traefik.io/v1alpha1
kind: IngressRoute
metadata:
name: scoresaber-reloaded-ingress
name: scoresaber-reloaded-frontend-ingress
namespace: public-services
annotations:
kubernetes.io/ingress.class: traefik-external
@ -18,7 +18,7 @@ spec:
- name: compress
namespace: traefik
services:
- name: scoresaber-reloaded-service
- name: scoresaber-reloaded-frontend-service
port: 3000
tls:
secretName: fascinated-cc

@ -3,7 +3,7 @@ apiVersion: bitnami.com/v1alpha1
kind: SealedSecret
metadata:
creationTimestamp: null
name: ssr-secret
name: ssr-frontend-secret
namespace: public-services
spec:
encryptedData:
@ -15,6 +15,6 @@ spec:
template:
metadata:
creationTimestamp: null
name: ssr-secret
name: ssr-frontend-secret
namespace: public-services
type: Opaque

@ -2,7 +2,7 @@
apiVersion: v1
kind: Service
metadata:
name: scoresaber-reloaded-service
name: scoresaber-reloaded-frontend-service
namespace: public-services
spec:
type: ClusterIP
@ -10,4 +10,4 @@ spec:
- port: 3000
targetPort: 3000
selector:
app: scoresaber-reloaded
app: scoresaber-reloaded-frontend

@ -1,4 +1,4 @@
name: "Deploy"
name: "Deploy Frontend"
on:
push:
@ -26,10 +26,11 @@ jobs:
uses: docker/build-push-action@v6
with:
context: .
file: ./apps/frontend/Dockerfile
push: true
tags: |
git.fascinated.cc/fascinated/scoresaber-reloaded:${{ github.sha }}
git.fascinated.cc/fascinated/scoresaber-reloaded:latest
git.fascinated.cc/fascinated/scoresaber-reloaded-frontend:${{ github.sha }}
git.fascinated.cc/fascinated/scoresaber-reloaded-frontend:latest
build-args: |
GIT_REV=${{ gitea.sha }}
SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }}
@ -49,9 +50,9 @@ jobs:
action: deploy
namespace: public-services
manifests: |
.gitea/kubernetes/sealed-secrets.yaml
.gitea/kubernetes/deployment.yaml
.gitea/kubernetes/service.yaml
.gitea/kubernetes/ingress.yaml
.gitea/kubernetes/frontend/sealed-secrets.yaml
.gitea/kubernetes/frontend/deployment.yaml
.gitea/kubernetes/frontend/service.yaml
.gitea/kubernetes/frontend/ingress.yaml
images: |
git.fascinated.cc/fascinated/scoresaber-reloaded:${{ github.sha }}
git.fascinated.cc/fascinated/scoresaber-reloaded-frontend:${{ github.sha }}

11
.gitignore vendored

@ -1,16 +1,15 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
node_modules
/.pnp
.pnp.js
.yarn/install-state.gz
# testing
/coverage
# next.js
/.next/
.next/
/out/
# production
@ -34,8 +33,6 @@ yarn-error.log*
# typescript
*.tsbuildinfo
next-env.d.ts
.turbo
.idea
# Sentry Config File
.env.sentry-build-plugin
.idea

@ -1,65 +0,0 @@
FROM fascinated/docker-images:nodejs_20_with_pnpm AS base
# Install dependencies and build tools for canvas
FROM base AS deps
RUN apk add --no-cache python3 make g++ gcc pkgconfig pixman cairo-dev libjpeg-turbo-dev pango-dev giflib-dev
WORKDIR /app
COPY package.json* pnpm-lock.yaml* ./
RUN pnpm install --frozen-lockfile --quiet
# Build from source
FROM base AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
# Install runtime dependencies
RUN apk add --no-cache cairo pango libjpeg-turbo giflib
ENV NEXT_TELEMETRY_DISABLED=1
# Add the commit hash
ARG GIT_REV
ENV GIT_REV=${GIT_REV}
# Add the sentry auth token
ARG SENTRY_AUTH_TOKEN
ENV SENTRY_AUTH_TOKEN=${SENTRY_AUTH_TOKEN}
# Build the app
RUN pnpm run build
# Final stage to run the app
FROM base AS runner
WORKDIR /app
# Install runtime dependencies
RUN apk add --no-cache cairo pango libjpeg-turbo giflib
ENV NODE_ENV=production
ENV NEXT_TELEMETRY_DISABLED=1
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs
RUN mkdir .next
RUN chown nextjs:nodejs .next
# Add the commit hash
ARG GIT_REV
ENV GIT_REV=${GIT_REV}
# Copy the built app from the builder stage
COPY --from=builder --chown=nextjs:nodejs /app/node_modules ./node_modules
COPY --from=builder --chown=nextjs:nodejs /app/.next ./.next
COPY --from=builder --chown=nextjs:nodejs /app/public ./public
COPY --from=builder --chown=nextjs:nodejs /app/package.json ./package.json
COPY --from=builder --chown=nextjs:nodejs /app/next.config.mjs ./next.config.mjs
USER nextjs
EXPOSE 3000
ENV HOSTNAME="0.0.0.0"
ENV PORT=3000
CMD ["pnpm", "start"]

@ -0,0 +1,3 @@
node_modules
.next
.turbo

@ -0,0 +1,9 @@
{
"extends": ["next/core-web-vitals", "next/typescript"],
"rules": {
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-unused-expressions": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-empty-object-type": "off"
}
}

41
apps/frontend/.gitignore vendored Normal file

@ -0,0 +1,41 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
/.pnp
.pnp.js
.yarn/install-state.gz
# testing
/coverage
# next.js
/.next/
/out/
# production
/build
# misc
.DS_Store
*.pem
# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# local env files
.env*.local
# vercel
.vercel
# typescript
*.tsbuildinfo
next-env.d.ts
.idea
# Sentry Config File
.env.sentry-build-plugin

@ -0,0 +1,12 @@
{
"semi": true,
"tabWidth": 2,
"useTabs": false,
"singleQuote": false,
"trailingComma": "es5",
"printWidth": 120,
"bracketSpacing": true,
"arrowParens": "avoid",
"jsxSingleQuote": false,
"jsxBracketSameLine": false
}

20
apps/frontend/Dockerfile Normal file

@ -0,0 +1,20 @@
FROM fascinated/docker-images:nodejs_20_with_pnpm
WORKDIR /app
COPY . .
RUN pnpm install
ENV NEXT_TELEMETRY_DISABLED 1
RUN pnpm i -g turbo@^2
RUN turbo prune frontend --docker
RUN turbo run build
# Add the commit hash
ARG GIT_REV
ENV GIT_REV=${GIT_REV}
EXPOSE 3000
CMD node apps/frontend/server.js

@ -0,0 +1,65 @@
FROM fascinated/docker-images:nodejs_20_with_pnpm AS base
FROM base AS builder
RUN apk update
RUN apk add --no-cache libc6-compat
# Set working directory
WORKDIR /app
RUN pnpm i -g turbo@^2
COPY . .
# Generate a partial monorepo with a pruned lockfile for a target workspace.
# Assuming "frontend" is the name entered in the project's package.json: { name: "frontend" }
RUN turbo prune frontend --docker
# Add lockfile and package.json's of isolated subworkspace
FROM base AS installer
WORKDIR /app
# Add the commit hash
ARG GIT_REV
ENV GIT_REV=${GIT_REV}
# Add the sentry auth token
ARG SENTRY_AUTH_TOKEN
ENV SENTRY_AUTH_TOKEN=${SENTRY_AUTH_TOKEN}
ENV NODE_ENV=production
ENV NEXT_TELEMETRY_DISABLED=1
RUN pnpm i -g turbo@^2
# First install the dependencies (as they change less often)
COPY --from=builder /app/out/json/ .
RUN pnpm install
# Build the project
COPY --from=builder /app/out/full/ .
RUN ls -la
RUN pnpm turbo run build --filter=frontend...
FROM base AS runner
WORKDIR /app
ENV NODE_ENV=production
ENV NEXT_TELEMETRY_DISABLED=1
# Add the commit hash
ARG GIT_REV
ENV GIT_REV=${GIT_REV}
# Don't run production as root
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs
USER nextjs
# Automatically leverage output traces to reduce image size
# https://nextjs.org/docs/advanced-features/output-file-tracing
COPY --from=installer --chown=nextjs:nodejs /app/apps/frontend/.next/standalone ./
COPY --from=installer --chown=nextjs:nodejs /app/apps/frontend/.next/static ./apps/frontend/.next/static
COPY --from=installer --chown=nextjs:nodejs /app/apps/frontend/public ./apps/frontend/public
CMD node apps/frontend/server.js

@ -0,0 +1,55 @@
import { format } from "@formkit/tempo";
/** @type {import('next').NextConfig} */
const nextConfig = {
experimental: {
webpackMemoryOptimizations: true,
},
images: {
remotePatterns: [
{
protocol: "https",
hostname: "cdn.scoresaber.com",
port: "",
pathname: "/**",
},
],
},
env: {
NEXT_PUBLIC_BUILD_ID: process.env.GIT_REV || "bob",
NEXT_PUBLIC_BUILD_TIME: new Date().toLocaleDateString("en-US", {
year: "numeric",
month: "long",
day: "numeric",
hour: "numeric",
minute: "numeric",
timeZoneName: "short",
}),
NEXT_PUBLIC_BUILD_TIME_SHORT: format(new Date(), {
date: "short",
time: "short",
}),
},
};
export default nextConfig;
// export default withSentryConfig(nextConfig, {
// org: "scoresaber-reloaded",
// project: "frontend",
// sentryUrl: "https://glitchtip.fascinated.cc/",
// silent: !process.env.CI,
// reactComponentAnnotation: {
// enabled: true,
// },
// tunnelRoute: "/monitoring",
// hideSourceMaps: true,
// disableLogger: true,
// sourcemaps: {
// disable: true,
// },
// release: {
// create: false,
// finalize: false,
// },
// });

@ -0,0 +1,64 @@
{
"name": "frontend",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"@formkit/tempo": "^0.1.2",
"@heroicons/react": "^2.1.5",
"@hookform/resolvers": "^3.9.0",
"@radix-ui/react-avatar": "^1.1.0",
"@radix-ui/react-icons": "^1.3.0",
"@radix-ui/react-label": "^2.1.0",
"@radix-ui/react-scroll-area": "^1.1.0",
"@radix-ui/react-slot": "^1.1.0",
"@radix-ui/react-toast": "^1.2.1",
"@radix-ui/react-tooltip": "^1.1.2",
"@sentry/nextjs": "8",
"@tanstack/react-query": "^5.55.4",
"@trigger.dev/nextjs": "^3.0.8",
"@trigger.dev/react": "^3.0.8",
"@trigger.dev/sdk": "^3.0.8",
"@uidotdev/usehooks": "^2.4.1",
"chart.js": "^4.4.4",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
"comlink": "^4.4.1",
"dexie": "^4.0.8",
"dexie-react-hooks": "^1.1.7",
"framer-motion": "^11.5.4",
"js-cookie": "^3.0.5",
"ky": "^1.7.2",
"lucide-react": "^0.446.0",
"mongoose": "^8.7.0",
"next": "15.0.0-rc.0",
"next-build-id": "^3.0.0",
"next-themes": "^0.3.0",
"react": "19.0.0-rc-3edc000d-20240926",
"react-chartjs-2": "^5.2.0",
"react-dom": "19.0.0-rc-3edc000d-20240926",
"react-hook-form": "^7.53.0",
"tailwind-merge": "^2.5.2",
"tailwindcss-animate": "^1.0.7",
"zod": "^3.23.8"
},
"devDependencies": {
"@types/js-cookie": "^3.0.6",
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
"eslint": "^8",
"eslint-config-next": "14.2.13",
"postcss": "^8",
"tailwindcss": "^3.4.1",
"typescript": "^5"
},
"trigger.dev": {
"endpointId": "scoresaber-reloaded-KB0Z"
}
}

7567
apps/frontend/pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load Diff

Before

Width:  |  Height:  |  Size: 1.4 MiB

After

Width:  |  Height:  |  Size: 1.4 MiB

Before

Width:  |  Height:  |  Size: 841 B

After

Width:  |  Height:  |  Size: 841 B

Before

Width:  |  Height:  |  Size: 132 B

After

Width:  |  Height:  |  Size: 132 B

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Before

Width:  |  Height:  |  Size: 766 B

After

Width:  |  Height:  |  Size: 766 B

Before

Width:  |  Height:  |  Size: 659 B

After

Width:  |  Height:  |  Size: 659 B

Before

Width:  |  Height:  |  Size: 604 B

After

Width:  |  Height:  |  Size: 604 B

Before

Width:  |  Height:  |  Size: 121 B

After

Width:  |  Height:  |  Size: 121 B

Before

Width:  |  Height:  |  Size: 522 B

After

Width:  |  Height:  |  Size: 522 B

Before

Width:  |  Height:  |  Size: 445 B

After

Width:  |  Height:  |  Size: 445 B

Before

Width:  |  Height:  |  Size: 320 B

After

Width:  |  Height:  |  Size: 320 B

Before

Width:  |  Height:  |  Size: 909 B

After

Width:  |  Height:  |  Size: 909 B

Before

Width:  |  Height:  |  Size: 109 B

After

Width:  |  Height:  |  Size: 109 B

Before

Width:  |  Height:  |  Size: 554 B

After

Width:  |  Height:  |  Size: 554 B

Before

Width:  |  Height:  |  Size: 311 B

After

Width:  |  Height:  |  Size: 311 B

Before

Width:  |  Height:  |  Size: 179 B

After

Width:  |  Height:  |  Size: 179 B

Before

Width:  |  Height:  |  Size: 214 B

After

Width:  |  Height:  |  Size: 214 B

Before

Width:  |  Height:  |  Size: 339 B

After

Width:  |  Height:  |  Size: 339 B

Before

Width:  |  Height:  |  Size: 324 B

After

Width:  |  Height:  |  Size: 324 B

Before

Width:  |  Height:  |  Size: 282 B

After

Width:  |  Height:  |  Size: 282 B

Before

Width:  |  Height:  |  Size: 127 B

After

Width:  |  Height:  |  Size: 127 B

Before

Width:  |  Height:  |  Size: 254 B

After

Width:  |  Height:  |  Size: 254 B

Before

Width:  |  Height:  |  Size: 105 B

After

Width:  |  Height:  |  Size: 105 B

Before

Width:  |  Height:  |  Size: 326 B

After

Width:  |  Height:  |  Size: 326 B

Before

Width:  |  Height:  |  Size: 651 B

After

Width:  |  Height:  |  Size: 651 B

Before

Width:  |  Height:  |  Size: 127 B

After

Width:  |  Height:  |  Size: 127 B

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Before

Width:  |  Height:  |  Size: 132 B

After

Width:  |  Height:  |  Size: 132 B

Before

Width:  |  Height:  |  Size: 810 B

After

Width:  |  Height:  |  Size: 810 B

Before

Width:  |  Height:  |  Size: 792 B

After

Width:  |  Height:  |  Size: 792 B

Before

Width:  |  Height:  |  Size: 287 B

After

Width:  |  Height:  |  Size: 287 B

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Before

Width:  |  Height:  |  Size: 206 B

After

Width:  |  Height:  |  Size: 206 B

Before

Width:  |  Height:  |  Size: 139 B

After

Width:  |  Height:  |  Size: 139 B

Before

Width:  |  Height:  |  Size: 377 B

After

Width:  |  Height:  |  Size: 377 B

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Before

Width:  |  Height:  |  Size: 359 B

After

Width:  |  Height:  |  Size: 359 B

Before

Width:  |  Height:  |  Size: 561 B

After

Width:  |  Height:  |  Size: 561 B

Before

Width:  |  Height:  |  Size: 523 B

After

Width:  |  Height:  |  Size: 523 B

Before

Width:  |  Height:  |  Size: 286 B

After

Width:  |  Height:  |  Size: 286 B

Before

Width:  |  Height:  |  Size: 344 B

After

Width:  |  Height:  |  Size: 344 B

Before

Width:  |  Height:  |  Size: 135 B

After

Width:  |  Height:  |  Size: 135 B

Before

Width:  |  Height:  |  Size: 123 B

After

Width:  |  Height:  |  Size: 123 B

Before

Width:  |  Height:  |  Size: 717 B

After

Width:  |  Height:  |  Size: 717 B

Before

Width:  |  Height:  |  Size: 263 B

After

Width:  |  Height:  |  Size: 263 B

Before

Width:  |  Height:  |  Size: 215 B

After

Width:  |  Height:  |  Size: 215 B

Before

Width:  |  Height:  |  Size: 286 B

After

Width:  |  Height:  |  Size: 286 B

Before

Width:  |  Height:  |  Size: 135 B

After

Width:  |  Height:  |  Size: 135 B

Before

Width:  |  Height:  |  Size: 419 B

After

Width:  |  Height:  |  Size: 419 B

Before

Width:  |  Height:  |  Size: 362 B

After

Width:  |  Height:  |  Size: 362 B

Before

Width:  |  Height:  |  Size: 444 B

After

Width:  |  Height:  |  Size: 444 B

Before

Width:  |  Height:  |  Size: 260 B

After

Width:  |  Height:  |  Size: 260 B

Before

Width:  |  Height:  |  Size: 641 B

After

Width:  |  Height:  |  Size: 641 B

Before

Width:  |  Height:  |  Size: 486 B

After

Width:  |  Height:  |  Size: 486 B

Before

Width:  |  Height:  |  Size: 361 B

After

Width:  |  Height:  |  Size: 361 B

Before

Width:  |  Height:  |  Size: 105 B

After

Width:  |  Height:  |  Size: 105 B

Before

Width:  |  Height:  |  Size: 530 B

After

Width:  |  Height:  |  Size: 530 B

Before

Width:  |  Height:  |  Size: 163 B

After

Width:  |  Height:  |  Size: 163 B

Before

Width:  |  Height:  |  Size: 501 B

After

Width:  |  Height:  |  Size: 501 B

Before

Width:  |  Height:  |  Size: 459 B

After

Width:  |  Height:  |  Size: 459 B

Before

Width:  |  Height:  |  Size: 368 B

After

Width:  |  Height:  |  Size: 368 B

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Before

Width:  |  Height:  |  Size: 106 B

After

Width:  |  Height:  |  Size: 106 B

Before

Width:  |  Height:  |  Size: 323 B

After

Width:  |  Height:  |  Size: 323 B

Before

Width:  |  Height:  |  Size: 358 B

After

Width:  |  Height:  |  Size: 358 B

Before

Width:  |  Height:  |  Size: 533 B

After

Width:  |  Height:  |  Size: 533 B

Before

Width:  |  Height:  |  Size: 828 B

After

Width:  |  Height:  |  Size: 828 B

Before

Width:  |  Height:  |  Size: 559 B

After

Width:  |  Height:  |  Size: 559 B

Before

Width:  |  Height:  |  Size: 160 B

After

Width:  |  Height:  |  Size: 160 B

Before

Width:  |  Height:  |  Size: 991 B

After

Width:  |  Height:  |  Size: 991 B

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Before

Width:  |  Height:  |  Size: 259 B

After

Width:  |  Height:  |  Size: 259 B

Before

Width:  |  Height:  |  Size: 192 B

After

Width:  |  Height:  |  Size: 192 B

Before

Width:  |  Height:  |  Size: 123 B

After

Width:  |  Height:  |  Size: 123 B

Before

Width:  |  Height:  |  Size: 106 B

After

Width:  |  Height:  |  Size: 106 B

Before

Width:  |  Height:  |  Size: 134 B

After

Width:  |  Height:  |  Size: 134 B

Some files were not shown because too many files have changed in this diff Show More