Compare commits

3 Commits

Author SHA1 Message Date
4349834509 Add build recipe to Justfile 2025-07-07 18:29:19 -04:00
0f67381b8c Fix multi-stage container build 2025-07-07 18:28:02 -04:00
44057c8c92 Basic Dockerfile 2025-07-06 15:58:54 -04:00
6 changed files with 70 additions and 2 deletions

16
.dockerignore Normal file
View File

@@ -0,0 +1,16 @@
.dockerignore
.editorconfig
.env
.git
.gitignore
.idea
.vscode
coverage*
docker-compose*
Dockerfile*
helm-charts
Justfile
LICENSE
Makefile
node_modules
README.md

1
.gitignore vendored
View File

@@ -1,3 +1,4 @@
node_modules
.env
config.json
build

37
Dockerfile Normal file
View File

@@ -0,0 +1,37 @@
# use the official Bun image
# see all versions at https://hub.docker.com/r/oven/bun/tags
FROM oven/bun:1 AS base
WORKDIR /usr/src/app
# install dependencies into temp directory
# this will cache them and speed up future builds
FROM base AS install
RUN mkdir -p /temp/dev
COPY package.json bun.lock /temp/dev/
RUN cd /temp/dev && bun install --frozen-lockfile
# install with --production (exclude devDependencies)
RUN mkdir -p /temp/prod
COPY package.json bun.lock /temp/prod/
RUN cd /temp/prod && bun install --frozen-lockfile --production
# copy node_modules from temp directory
# then copy all (non-ignored) project files into the image
FROM base AS prerelease
COPY --from=install /temp/dev/node_modules node_modules
COPY . .
# [optional] tests & build
ENV NODE_ENV=production
# RUN bun test
RUN bun build --target bun --outdir build index.ts
# copy production dependencies and source code into final image
FROM base AS release
COPY --from=install /temp/prod/node_modules node_modules
COPY --from=prerelease /usr/src/app/build/index.js .
# run the app
USER bun
EXPOSE 3000/tcp
ENTRYPOINT [ "bun", "run", "index.js" ]

View File

@@ -5,6 +5,14 @@ fmt:
format:
bunx --bun @biomejs/biome format --write *.ts plugins/
lint:
bunx --bun @biomejs/biome lint --fix *.ts plugins/
bunx --bun @biomejs/biome lint --fix *.ts plugins/
build:
bun build --target bun --outdir build index.ts
docker-build:
docker build --pull -t blitzcrank:latest-dev .
docker-run:
docker run --env-file .env blitzcrank:latest-dev

View File

@@ -7,6 +7,7 @@
"@biomejs/biome": "^2.0.6",
"chrono-node": "^2.8.3",
"discord.js": "^14.21.0",
"pg-hstore": "^2.3.4",
"sequelize": "^6.37.7",
"sqlite3": "^5.1.7",
},
@@ -406,6 +407,8 @@
"pg-connection-string": ["pg-connection-string@2.9.1", "", {}, "sha512-nkc6NpDcvPVpZXxrreI/FOtX3XemeLl8E0qFr6F2Lrm/I8WOnaWNhIPK2Z7OHpw7gh5XJThi6j6ppgNoaT1w4w=="],
"pg-hstore": ["pg-hstore@2.3.4", "", { "dependencies": { "underscore": "^1.13.1" } }, "sha512-N3SGs/Rf+xA1M2/n0JBiXFDVMzdekwLZLAO0g7mpDY9ouX+fDI7jS6kTq3JujmYbtNSJ53TJ0q4G98KVZSM4EA=="],
"picocolors": ["picocolors@1.1.1", "", {}, "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA=="],
"picomatch": ["picomatch@4.0.2", "", {}, "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg=="],
@@ -506,6 +509,8 @@
"tunnel-agent": ["tunnel-agent@0.6.0", "", { "dependencies": { "safe-buffer": "^5.0.1" } }, "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w=="],
"underscore": ["underscore@1.13.7", "", {}, "sha512-GMXzWtsc57XAtguZgaQViUOzs0KTkk8ojr3/xAxXLITqf/3EMwxC0inyETfDFjH/Krbhuep0HNbbjI9i/q3F3g=="],
"undici": ["undici@6.21.3", "", {}, "sha512-gBLkYIlEnSp8pFbT64yFgGE6UIB9tAkhukC23PmMDCe5Nd+cRqKxSjw5y54MK2AZMgZfJWMaNE4nYUHgi1XEOw=="],
"undici-types": ["undici-types@7.8.0", "", {}, "sha512-9UJ2xGDvQ43tYyVMpuHlsgApydB8ZKfVYTsLDhXkFL/6gfkp+U8xTGdh8pMJv1SpZna0zxG1DwsKZsreLbXBxw=="],

View File

@@ -11,6 +11,7 @@
"@biomejs/biome": "^2.0.6",
"chrono-node": "^2.8.3",
"discord.js": "^14.21.0",
"pg-hstore": "^2.3.4",
"sequelize": "^6.37.7",
"sqlite3": "^5.1.7"
},