Skip to content
Merged
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
10 changes: 2 additions & 8 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,9 @@
# If you need more help, visit the Dockerfile reference guide at
# https://docs.docker.com/engine/reference/builder/

ARG NODE_MAJOR_VERSION=24
# Necessary to run "pnpm install" when the Dev Container has started.
ARG PNPM_MAJOR_VERSION=10
ARG BUN_MAJOR_VERSION=1

FROM node:${NODE_MAJOR_VERSION}-alpine as base
RUN --mount=type=cache,target=/root/.npm \
npm install -g pnpm@${PNPM_MAJOR_VERSION}
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
FROM oven/bun:${BUN_MAJOR_VERSION}-alpine AS base

# https://code.visualstudio.com/remote/advancedcontainers/sharing-git-credentials#_sharing-gpg-keys
RUN apk add --no-cache bash bash-completion git gnupg gcompat
Expand Down
24 changes: 12 additions & 12 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,19 @@
// "shutdownAction": "none",

// Uncomment the next line to run commands after the container is created.
"postCreateCommand": "corepack up && pnpm install",
"postCreateCommand": "bun install",

// When building the dev container for the first time, it works but file permissions do not work.
// Only root has permissions. https://github.com/microsoft/vscode-remote-release/issues/4646
// This command does not actually work...
// "updateContentCommand": "chown -R node:node /workspaces",
// "updateContentCommand": "chown -R bun:bun /workspaces",

// Configure tool-specific properties.
"customizations": {
"vscode": {
"extensions": [
"ms-azuretools.vscode-containers",
"oven.bun-vscode",
"biomejs.biome",
"bradlc.vscode-tailwindcss",
"wix.vscode-import-cost",
Expand All @@ -48,27 +49,26 @@
"settings": {
"git.enabled": true,
"terminal.integrated.defaultProfile.linux": "bash",
"npm.packageManager": "bun",
"npm.scriptRunner": "bun",
"editor.defaultFormatter": "biomejs.biome",
"editor.codeActionsOnSave": {
"source.fixAll.biome": "explicit"
},
"js/ts.tsdk.path": "node_modules/.pnpm/node_modules/typescript/lib",
"js/ts.tsdk.path": "node_modules/.bun/node_modules/typescript/lib",
"json.schemaDownload.trustedDomains": {
"https://ui.shadcn.com/schema.json": true
},
// Debug settings.
"launch": {
"version": "0.2.0",
"configurations": [
// Method 2: https://tsx.is/vscode
{
"name": "Attach to process",
"type": "node",
"name": "Attach to Bun",
"type": "bun",
"request": "attach",
"port": 9229,
"skipFiles": [
// Node.js internal core modules.
"<node_internals>/**",
// Ignore all dependencies (optional).
"${workspaceFolder}/node_modules/**"
]
"url": "ws://localhost:6499/"
}
]
}
Expand Down
16 changes: 4 additions & 12 deletions .github/workflows/biome.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,10 @@ permissions:
contents: read

jobs:
build:
biome:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [24]
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- run: pnpm install
- run: pnpm run check
- uses: oven-sh/setup-bun@v2
- run: bun install
- run: bun run check
14 changes: 3 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,8 @@ env:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [24]
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- run: pnpm install
- run: pnpm run build
- uses: oven-sh/setup-bun@v2
- run: bun install
- run: bun run build
16 changes: 4 additions & 12 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,10 @@ permissions:
contents: read

jobs:
build:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [24]
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- run: pnpm install
- run: pnpm test
- uses: oven-sh/setup-bun@v2
- run: bun install
- run: bun test
2 changes: 1 addition & 1 deletion apps/bot/.typesafe-i18n.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://unpkg.com/typesafe-i18n@5.26.2/schema/typesafe-i18n.json",
"$schema": "./node_modules/typesafe-i18n/schema/typesafe-i18n.json",
"baseLocale": "en-GB",
"adapter": "node",
"esmImports": true,
Expand Down
25 changes: 7 additions & 18 deletions apps/bot/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,17 @@
# If you need more help, visit the Dockerfile reference guide at
# https://docs.docker.com/engine/reference/builder/

# This problem has caused pain: https://github.com/pnpm/pnpm/issues/6088
# The solution? Do not use dependenciesMeta.injected (until further notice).

ARG NODE_MAJOR_VERSION=24
ARG PNPM_MAJOR_VERSION=10
ARG BUN_MAJOR_VERSION=1
ARG TURBO_MAJOR_VERSION=2

FROM node:${NODE_MAJOR_VERSION}-alpine AS base
RUN --mount=type=cache,target=/root/.npm \
npm install -g pnpm@${PNPM_MAJOR_VERSION}
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
FROM oven/bun:${BUN_MAJOR_VERSION}-alpine AS base

# Require the dependencies which "@ticketer/bot" depends on.
FROM base AS builder
RUN apk add --no-cache libc6-compat
RUN apk update
WORKDIR /src
RUN pnpm add -g turbo@${TURBO_MAJOR_VERSION}
RUN bun add --global turbo@${TURBO_MAJOR_VERSION}
COPY . .
RUN turbo prune @ticketer/bot --docker

Expand All @@ -33,11 +25,8 @@ WORKDIR /src

# Install the dependencies.
COPY --from=builder /src/out/json/ .
COPY --from=builder /src/out/pnpm-lock.yaml ./pnpm-lock.yaml
RUN --mount=type=bind,source=package.json,target=package.json \
--mount=type=bind,source=pnpm-lock.yaml,target=pnpm-lock.yaml \
--mount=type=cache,target=/root/.local/share/pnpm/store \
pnpm install --prod --frozen-lockfile
COPY --from=builder /src/out/bun.lock ./bun.lock
RUN bun install --production --frozen-lockfile

# Build the project and its dependencies.
COPY --from=builder /src/out/full/ .
Expand All @@ -46,9 +35,9 @@ COPY turbo.json turbo.json
# Copy the files over and use the apps/bot directory.
FROM base AS runner
WORKDIR /src
USER node
USER bun
COPY --from=installer /src .
WORKDIR /src/apps/bot

# Run the bot.
CMD ["pnpm", "start"]
CMD ["bun", "start"]
11 changes: 5 additions & 6 deletions apps/bot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
"main": "./src/index.ts",
"type": "module",
"scripts": {
"dev": "tsx watch --env-file=.env.bot.development.local .",
"debug": "tsx watch --inspect-wait --env-file=.env.bot.development.local .",
"start": "tsx .",
"dev": "bun --env-file=.env.bot.development.local .",
"debug": "bun --inspect-wait --env-file=.env.bot.development.local .",
"start": "bun .",
"check": "biome check --write",
"commands:deploy:development": "tsx --env-file=.env.bot.development.local ./src/deploy.ts",
"commands:deploy:production": "tsx ./src/deploy.ts",
"commands:deploy:development": "bun --env-file=.env.bot.development.local ./src/deploy.ts",
"commands:deploy:production": "bun ./src/deploy.ts",
"i18n": "typesafe-i18n"
},
"dependencies": {
Expand All @@ -19,7 +19,6 @@
"@ticketer/tsconfig": "workspace:*",
"chalk": "^5.6.2",
"discord.js": "^14.26.3",
"tsx": "^4.21.0",
"typesafe-i18n": "^5.27.1",
"zod": "^4.3.6"
}
Expand Down
2 changes: 1 addition & 1 deletion apps/bot/src/bot.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { fileURLToPath } from 'node:url';
import { Client } from '@ticketer/djs-framework';
import { environment } from '@ticketer/env/bot';
import { fileURLToPath } from 'bun';
import { GatewayIntentBits, Options } from 'discord.js';
import { refreshGuildBlacklist } from '@/utils';

Expand Down
2 changes: 1 addition & 1 deletion apps/bot/src/deploy.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { exit } from 'node:process';
import { fileURLToPath } from 'node:url';
import { Client } from '@ticketer/djs-framework';
import { environment } from '@ticketer/env/bot';
import { fileURLToPath } from 'bun';
import chalk from 'chalk';

const client = new Client({
Expand Down
3 changes: 1 addition & 2 deletions apps/bot/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { fileURLToPath } from 'node:url';
import { environment } from '@ticketer/env/bot';
import { fileURLToPath } from 'bun';
import chalk from 'chalk';
import { ShardingManager } from 'discord.js';
import { formatDateLong } from '@/utils';

const sharder = new ShardingManager(fileURLToPath(import.meta.resolve('./bot.ts')), {
execArgv: ['--import=tsx'],
mode: 'process',
token: environment.DISCORD_BOT_TOKEN,
});
Expand Down
30 changes: 11 additions & 19 deletions apps/website/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,39 +4,31 @@
# If you need more help, visit the Dockerfile reference guide at
# https://docs.docker.com/engine/reference/builder/

ARG NODE_MAJOR_VERSION=24
ARG PNPM_MAJOR_VERSION=10
ARG BUN_MAJOR_VERSION=1
ARG TURBO_MAJOR_VERSION=2

FROM node:${NODE_MAJOR_VERSION}-alpine AS base
RUN --mount=type=cache,target=/root/.npm \
npm install -g pnpm@${PNPM_MAJOR_VERSION}
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
FROM oven/bun:${BUN_MAJOR_VERSION}-alpine AS base
ENV NODE_ENV=production

# Require the dependencies which "@ticketer/website" depends on.
FROM base AS builder
RUN apk add --no-cache libc6-compat
RUN apk update
WORKDIR /src
RUN pnpm add -g turbo@${TURBO_MAJOR_VERSION}
RUN bun add --global turbo@${TURBO_MAJOR_VERSION}
COPY . .
RUN turbo prune @ticketer/website --docker

FROM base AS installer
RUN apk add --no-cache libc6-compat
RUN apk update
WORKDIR /src
RUN pnpm add -g turbo@${TURBO_MAJOR_VERSION}
RUN bun add --global turbo@${TURBO_MAJOR_VERSION}

# Install the dependencies.
COPY --from=builder /src/out/json/ .
COPY --from=builder /src/out/pnpm-lock.yaml ./pnpm-lock.yaml
RUN --mount=type=bind,source=package.json,target=package.json \
--mount=type=bind,source=pnpm-lock.yaml,target=pnpm-lock.yaml \
--mount=type=cache,target=/root/.local/share/pnpm/store \
pnpm install --frozen-lockfile
COPY --from=builder /src/out/bun.lock ./bun.lock
RUN bun install --frozen-lockfile

# Build the project and its dependencies.
COPY --from=builder /src/out/full/ .
Expand All @@ -62,18 +54,18 @@ RUN turbo run build --filter=@ticketer/website
FROM base AS runner
RUN apk add --no-cache curl
WORKDIR /src
USER node
USER bun

# https://turborepo.com/docs/guides/tools/docker
# Automatically leverage output traces to reduce image size
# https://nextjs.org/docs/advanced-features/output-file-tracing
COPY --from=installer --chown=node:node /src/apps/website/.next/standalone ./
COPY --from=installer --chown=node:node /src/apps/website/.next/static ./apps/website/.next/static
COPY --from=installer --chown=node:node /src/apps/website/public ./apps/website/public
COPY --from=installer --chown=bun:bun /src/apps/website/.next/standalone ./
COPY --from=installer --chown=bun:bun /src/apps/website/.next/static ./apps/website/.next/static
COPY --from=installer --chown=bun:bun /src/apps/website/public ./apps/website/public

ENV HOSTNAME=0.0.0.0
ENV PORT=2027
EXPOSE ${PORT}

# Run the website.
CMD ["node", "apps/website/server.js"]
CMD ["bun", "run", "apps/website/server.js"]
5 changes: 3 additions & 2 deletions apps/website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
"private": true,
"scripts": {
"dev": "next dev --port 2027",
"debug": "pnpm run dev",
"debug": "bun run dev",
"build": "NODE_ENV=production NEXT_TELEMETRY_DISABLED=1 next build",
"start": "NODE_ENV=production next start --port 2027",
"typegen": "next typegen",
"check": "pnpm run typegen && biome check --write"
"check": "bun run typegen && biome check --write"
},
"dependencies": {
"@icons-pack/react-simple-icons": "^13.13.0",
Expand Down Expand Up @@ -39,6 +39,7 @@
"devDependencies": {
"@tailwindcss/postcss": "^4.2.2",
"@ticketer/tsconfig": "workspace:*",
"@types/node": "^25.6.0",
"@types/react": "^19.2.14",
"@types/react-dom": "^19.2.3",
"autoprefixer": "^10.5.0",
Expand Down
4 changes: 2 additions & 2 deletions apps/website/src/app/[locale]/docs/self-hosting/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -257,10 +257,10 @@ export default async function Page({ params }: PageProps<'/[locale]/docs/self-ho
</span>
</CodeBlock>
<Paragraph>{t('content.running-the-bot.paragraphs.2')}</Paragraph>
<CodeBlock clipboardText='docker exec ticketer-bot sh -c "cd /src/apps/bot && pnpm commands:deploy:production"'>
<CodeBlock clipboardText='docker exec ticketer-bot sh -c "cd /src/apps/bot && bun run commands:deploy:production"'>
<span>
<span className="text-green-500">docker </span>
<span>exec ticketer-bot sh -c &quot;cd /src/apps/bot && pnpm commands:deploy:production&quot;</span>
<span>exec ticketer-bot sh -c &quot;cd /src/apps/bot && bun run commands:deploy:production&quot;</span>
</span>
</CodeBlock>
<Paragraph>
Expand Down
3 changes: 2 additions & 1 deletion apps/website/src/app/[locale]/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,10 @@ export default async function RootLayout({ children, params }: LayoutProps<'/[lo
{environment.NEXT_PUBLIC_UMAMI_ID && environment.NEXT_PUBLIC_UMAMI_URL && (
<Script
defer
strategy="afterInteractive"
src={new URL('/script.js', environment.NEXT_PUBLIC_UMAMI_URL).toString()}
data-website-id={environment.NEXT_PUBLIC_UMAMI_ID}
strategy="afterInteractive"
data-performance="true"
/>
)}
<body className={cn('min-h-screen bg-background font-sans antialiased', font.variable)}>
Expand Down
Loading
Loading