Skip to content

Commit

Permalink
build: docker deployment support
Browse files Browse the repository at this point in the history
  • Loading branch information
ikxin committed May 30, 2024
1 parent 8e44943 commit 5bf0bd3
Show file tree
Hide file tree
Showing 16 changed files with 37 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.DS_Store
.git
node_modules
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PORT = 3000
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
.vscode
.idea
.DS_Store
node_modules
Expand Down
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"editor.formatOnSave": true,
"i18n-ally.localesPaths": ["src/locales"]
}
25 changes: 25 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
FROM node:lts as builder

WORKDIR /app

COPY . .

RUN npm i -g bun \
&& bun install \
&& bun run db:init \
&& bun run db:migrate \
&& bun run build \
&& bun build ./service/index.ts --compile --outfile kms-tools

FROM oven/bun:latest

COPY --from=builder /app/kms-tools /app/kms-tools
COPY --from=builder /app/sqlite.db /app/sqlite.db
COPY --from=builder /app/dist /app/dist
COPY --from=builder /app/service/binaries /app/service/binaries

WORKDIR /app

EXPOSE 3000 1688

CMD ["./kms-tools"]
Binary file modified bun.lockb
Binary file not shown.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"@typescript-eslint/eslint-plugin": "^7.11.0",
"@typescript-eslint/parser": "^7.11.0",
"@vitejs/plugin-vue": "^5.0.4",
"better-sqlite3": "^10.0.0",
"cron": "^3.1.7",
"drizzle-kit": "^0.21.4",
"drizzle-orm": "^0.30.10",
Expand Down
Binary file removed service/binaries/vlmcs-darwin-x86
Binary file not shown.
Binary file added service/binaries/vlmcs-linux-arm64
Binary file not shown.
Binary file added service/binaries/vlmcs-linux-x64
Binary file not shown.
Binary file added service/binaries/vlmcs-win32-x64.exe
Binary file not shown.
Binary file removed service/binaries/vlmcsd-darwin-x86
Binary file not shown.
Binary file added service/binaries/vlmcsd-linux-arm64
Binary file not shown.
Binary file added service/binaries/vlmcsd-linux-x64
Binary file not shown.
Binary file added service/binaries/vlmcsd-win32-x64.exe
Binary file not shown.
5 changes: 3 additions & 2 deletions service/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ const runVlmcs = ({
new CronJob(
'0/20 * * * * *',
async function () {
console.log(new Date())
for (const item of vlmcsdServers) {
const result = await runVlmcs({ domain: item })
db.insert(schema.logs)
Expand Down Expand Up @@ -91,12 +92,12 @@ app.get('/api/logs', async () => {
return await db.query.logs.findMany()
})

app.post('/api/check', async (request) => {
app.post('/api/check', async request => {
const body = request.body as RunVlmcsType
return await runVlmcs(body)
})

app.listen(3000)
app.listen(Bun.env.PORT || 3000)

console.log(`Elysia is running at on port ${app.server?.url} ...`)

Expand Down

0 comments on commit 5bf0bd3

Please sign in to comment.