-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #38 from hackerspace-ntnu/lighthouse
Lighthouse
- Loading branch information
Showing
11 changed files
with
198 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
name: Code Quality | ||
|
||
on: | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
lint-format: | ||
name: Lint & Format | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Setup Biome | ||
uses: biomejs/setup-biome@v2 | ||
with: | ||
version: latest | ||
- name: Run Biome | ||
run: biome ci . | ||
performance-audit: | ||
name: Performance Audit | ||
runs-on: ubuntu-latest | ||
env: | ||
NEXT_TELEMETRY_DISABLED: true | ||
NODE_ENV: "production" | ||
NEXT_PUBLIC_SITE_URL: "http://localhost:3000" | ||
DATABASE_HOST: "localhost" | ||
DATABASE_PORT: "5432" | ||
DATABASE_USER: "user" | ||
DATABASE_PASSWORD: "password" | ||
DATABASE_NAME: "database" | ||
STORAGE_HOST: "localhost" | ||
STORAGE_PORT: "9000" | ||
STORAGE_USER: "user" | ||
STORAGE_PASSWORD: "password" | ||
STORAGE_NAME: "images" | ||
FEIDE_CLIENT_ID: " " | ||
FEIDE_CLIENT_SECRET: " " | ||
FEIDE_AUTHORIZATION_ENDPOINT: "https://auth.dataporten.no/oauth/authorization" | ||
FEIDE_TOKEN_ENDPOINT: "https://auth.dataporten.no/oauth/token" | ||
FEIDE_USERINFO_ENDPOINT: "https://auth.dataporten.no/openid/userinfo" | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Setup bun | ||
uses: oven-sh/setup-bun@v2 | ||
with: | ||
bun-version: latest | ||
- name: Install Dependencies | ||
run: bun install --frozen-lockfile | ||
- name: Build | ||
run: bun run build | ||
- name: Run Lighthouse | ||
env: | ||
LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }} | ||
run: | | ||
bun add -g @lhci/cli@0.13.x | ||
lhci autorun |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,88 @@ | ||
FROM imbios/bun-node:20-slim | ||
FROM imbios/bun-node:22-slim AS base | ||
|
||
# Install dependencies only when needed | ||
FROM base AS deps | ||
|
||
WORKDIR /app | ||
|
||
COPY package.json bun.lockb ./ | ||
ENV NODE_ENV=production | ||
|
||
RUN bun install --production --frozen-lockfile | ||
# Install dependencies | ||
COPY package.json bun.lockb ./ | ||
RUN bun install --frozen-lockfile | ||
|
||
# Rebuild the source code only when needed | ||
FROM base AS builder | ||
WORKDIR /app | ||
COPY --from=deps /app/node_modules ./node_modules | ||
COPY . . | ||
|
||
ENV NODE_ENV=production | ||
ENV NEXT_TELEMETRY_DISABLED=1 | ||
ENV SKIP_ENV_VALIDATION=true | ||
|
||
# Set environment variables during the build | ||
ARG NEXT_PUBLIC_SITE_URL | ||
ARG DATABASE_USER | ||
ARG DATABASE_PASSWORD | ||
ARG DATABASE_HOST | ||
ARG DATABASE_PORT | ||
ARG DATABASE_NAME | ||
ARG STORAGE_HOST | ||
ARG STORAGE_PORT | ||
ARG STORAGE_USER | ||
ARG STORAGE_PASSWORD | ||
ARG STORAGE_NAME | ||
ARG FEIDE_CLIENT_ID | ||
ARG FEIDE_CLIENT_SECRET | ||
ARG FEIDE_AUTHORIZATION_ENDPOINT | ||
ARG FEIDE_TOKEN_ENDPOINT | ||
ARG FEIDE_USERINFO_ENDPOINT | ||
|
||
ENV NEXT_PUBLIC_SITE_URL=$NEXT_PUBLIC_SITE_URL | ||
ENV DATABASE_USER=$DATABASE_USER | ||
ENV DATABASE_PASSWORD=$DATABASE_PASSWORD | ||
ENV DATABASE_HOST=$DATABASE_HOST | ||
ENV DATABASE_PORT=$DATABASE_PORT | ||
ENV DATABASE_NAME=$DATABASE_NAME | ||
ENV STORAGE_HOST=$STORAGE_HOST | ||
ENV STORAGE_PORT=$STORAGE_PORT | ||
ENV STORAGE_USER=$STORAGE_USER | ||
ENV STORAGE_PASSWORD=$STORAGE_PASSWORD | ||
ENV STORAGE_NAME=$STORAGE_NAME | ||
ENV FEIDE_CLIENT_ID=$FEIDE_CLIENT_ID | ||
ENV FEIDE_CLIENT_SECRET=$FEIDE_CLIENT_SECRET | ||
ENV FEIDE_AUTHORIZATION_ENDPOINT=$FEIDE_AUTHORIZATION_ENDPOINT | ||
ENV FEIDE_TOKEN_ENDPOINT=$FEIDE_TOKEN_ENDPOINT | ||
ENV FEIDE_USERINFO_ENDPOINT=$FEIDE_USERINFO_ENDPOINT | ||
|
||
# Build the application | ||
RUN bunx next build | ||
|
||
|
||
# Production image, copy all the files and run next | ||
FROM base AS runner | ||
WORKDIR /app | ||
|
||
ENV NODE_ENV=production | ||
RUN bun run build | ||
ENV NEXT_TELEMETRY_DISABLED=1 | ||
ENV SKIP_ENV_VALIDATION=true | ||
|
||
RUN addgroup --system --gid 1002 nodejs && \ | ||
adduser --system --uid 1002 nextjs | ||
|
||
COPY --from=builder /app/public ./public | ||
|
||
# Set the correct permission for prerender cache | ||
RUN mkdir .next && chown nextjs:nodejs .next | ||
|
||
# Automatically leverage output traces to reduce image size | ||
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./ | ||
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static | ||
|
||
USER nextjs | ||
|
||
EXPOSE 3000 | ||
|
||
ENTRYPOINT [ "bun", "run", "start" ] | ||
# server.js is created by next build from the standalone output | ||
CMD ["bun", "run", "server.js"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
ci: | ||
collect: | ||
url: | ||
- 'http://localhost:3000/en' | ||
- 'http://localhost:3000/en/events' | ||
- 'http://localhost:3000/en/news' | ||
- 'http://localhost:3000/en/news/1' | ||
- 'http://localhost:3000/en/about' | ||
startServerCommand: 'bun run start' | ||
upload: | ||
target: 'temporary-public-storage' | ||
assert: | ||
preset: 'lighthouse:recommended' | ||
assertions: | ||
first-contentful-paint: | ||
- error | ||
- maxNumericValue: 2000 | ||
aggregationMethod: optimistic | ||
interactive: | ||
- error | ||
- maxNumericValue: 5000 | ||
aggregationMethod: optimistic | ||
bf-cache: 'off' | ||
csp-xss: 'off' | ||
identical-links-same-purpose: 'off' | ||
total-byte-weight: 'off' | ||
color-contrast: 'off' | ||
heading-order: 'off' | ||
mainthread-work-breakdown: 'off' | ||
bootup-time: 'off' | ||
largest-contentful-paint: 'off' | ||
dom-size: 'off' | ||
render-blocking-resources: 'off' | ||
server-response-time: 'off' | ||
uses-responsive-images: 'off' | ||
maskable-icon: 'off' | ||
installable-manifest: 'off' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters