Compare commits

...
2 Commits
Author SHA1 Message Date
dominicf ac087c458d Deployment updates 2026-08-22 20:00:57 -04:00
dominicf 2982c1ee99 Set up deployment 2026-08-22 19:50:35 -04:00
6 changed files with 32 additions and 8 deletions
+12 -3
View File
@@ -7,11 +7,20 @@ WORKDIR /app
COPY package.json bun.lock ./
RUN bun install --frozen-lockfile --production
FROM oven/bun:1-alpine AS runner
FROM oven/bun:1-alpine AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY tsconfig.json ./
COPY package.json tsconfig.json ./
COPY src ./src
RUN bun run build
FROM oven/bun:1-alpine AS runner
WORKDIR /app
COPY --from=builder /app/dist ./dist
RUN mkdir -p /app/data && chown -R bun:bun /app/data
VOLUME ["/app/data"]
USER bun
CMD ["bun", "src/index.ts"]
CMD ["bun", "dist/index.js"]
Executable
+7
View File
@@ -0,0 +1,7 @@
#!/usr/bin/env bash
set -euo pipefail
cd "$(dirname "$0")"
fly secrets import --stage < .env.production
fly deploy
+7 -2
View File
@@ -1,11 +1,16 @@
# fly.toml app configuration file generated for kaczynski-bot-2-0 on 2026-05-16T14:37:01-04:00
# fly.toml app configuration file generated for kaczynski-bot on 2026-08-22T19:58:11-04:00
#
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#
app = 'kaczynski-bot-2-0'
app = 'kaczynski-bot'
primary_region = 'iad'
[build]
[[mounts]]
source = 'data'
destination = '/app/data'
[http_service]
internal_port = 8080
force_https = true
+2 -1
View File
@@ -6,7 +6,8 @@
"@types/node": "^25.9.5"
},
"scripts": {
"dev": "bun run src/index.ts"
"dev": "bun run src/index.ts",
"build": "bun build ./src/index.ts $(find src/cmd/registry -name \"*.ts\") --target bun --minify --splitting --root src --outdir ./dist"
},
"peerDependencies": {
"typescript": "^5.9.3"
+3 -1
View File
@@ -1,15 +1,17 @@
import type { Message } from "discord.js";
import { readdir } from "fs/promises";
import { dirname } from "path";
import type { Command } from "../models";
const CMD_PREFIX = ".";
const CMD_REGISTRY_DIR = `${dirname(Bun.main)}/cmd/registry`;
export default abstract class CommandService {
private static registry: Record<string, Command> = {}
static async init() {
const commands = await Promise.all(
(await readdir(`${import.meta.dir}/../cmd/registry`)).map(async file => (await import(`../cmd/registry/${file}`)).default satisfies Command)
(await readdir(CMD_REGISTRY_DIR)).map(async file => (await import(`${CMD_REGISTRY_DIR}/${file}`)).default satisfies Command)
);
for (const command of commands)
CommandService.registry[command.name] = command;
+1 -1
View File
@@ -3,7 +3,7 @@ interface Data {
}
export default class DataService {
private static readonly DATA_PATH = "./data.json";
private static readonly DATA_PATH = "./data/data.json";
private static file: Bun.BunFile | undefined;
private static _data: Data = {
// default values (will be overwritten)