parent
f9e665b2e6
commit
50e031fc4b
21
.gitea/workflows/deploy.yml
Normal file
21
.gitea/workflows/deploy.yml
Normal file
@ -0,0 +1,21 @@
|
||||
name: "Deploy SSR"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Cloning repo
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Push to dokku
|
||||
uses: dokku/github-action@master
|
||||
with:
|
||||
git_remote_url: "ssh://dokku@10.0.50.65:22/ssr"
|
||||
ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }}
|
43
Dockerfile
Normal file
43
Dockerfile
Normal file
@ -0,0 +1,43 @@
|
||||
FROM fascinated/docker-images:node-pnpm-latest AS base
|
||||
|
||||
# Install depends
|
||||
FROM base AS deps
|
||||
RUN apk add --no-cache libc6-compat
|
||||
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 . .
|
||||
ENV NEXT_TELEMETRY_DISABLED 1
|
||||
|
||||
# Build the app
|
||||
RUN pnpm run build
|
||||
|
||||
# Run the app
|
||||
FROM base AS runner
|
||||
WORKDIR /app
|
||||
|
||||
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
|
||||
|
||||
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.js ./next.config.js
|
||||
|
||||
USER nextjs
|
||||
EXPOSE 80
|
||||
ENV HOSTNAME "0.0.0.0"
|
||||
ENV PORT 80
|
||||
CMD ["pnpm", "start"]
|
@ -1,5 +1,4 @@
|
||||
import { scoresaberLeaderboard } from "@/app/common/leaderboard/impl/scoresaber";
|
||||
import { ScoreSort } from "@/app/common/leaderboard/sort";
|
||||
import { formatNumberWithCommas } from "@/app/common/number-utils";
|
||||
import PlayerData from "@/app/components/player/player-data";
|
||||
import { format } from "@formkit/tempo";
|
||||
@ -40,15 +39,12 @@ export async function generateMetadata({ params: { slug } }: Props): Promise<Met
|
||||
|
||||
export default async function Search({ params: { slug } }: Props) {
|
||||
const id = slug[0]; // The players id
|
||||
const sort: ScoreSort = (slug[1] as ScoreSort) || "recent"; // The sorting method
|
||||
const page = slug[2] || 1; // The page number
|
||||
// const sort: ScoreSort = (slug[1] as ScoreSort) || "recent"; // The sorting method
|
||||
// const page = slug[2] || 1; // The page number
|
||||
const player = await scoresaberLeaderboard.lookupPlayer(id, false);
|
||||
|
||||
console.log("id", id);
|
||||
console.log("sort", sort);
|
||||
console.log("page", page);
|
||||
|
||||
if (player == undefined) {
|
||||
// Invalid player id
|
||||
return redirect("/");
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user