Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
19 changes: 19 additions & 0 deletions docker-scripts.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env node
import { execSync } from "child_process";
import packageJson from "./package.json" with { type: "json" };

const version = packageJson.version;
const command = process.argv[2];
Comment thread
Saanicc marked this conversation as resolved.

const cmds = {
build: `docker build --platform linux/amd64 -t gaming-music-bot:${version} -t gaming-music-bot:latest .`,
save: `docker save gaming-music-bot:${version} -o music-discord-bot-${version}.tar`,
};

if (!cmds[command]) {
console.error(`Unknown command: ${command}. Use 'build' or 'save'.`);
process.exit(1);
}

console.log(`Running: ${cmds[command]}`);
execSync(cmds[command], { stdio: "inherit" });
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"dev": "tsx watch src/index.ts",
"start": "node dist/index.js",
"build": "tsup src/index.ts --format esm --minify --external unfetch,ffmpeg-static",
"docker-build": "VERSION=$(node -p \"require('./package.json').version\") && docker build --platform linux/amd64 -t gaming-music-bot:$VERSION -t gaming-music-bot:latest .",
"docker-save": "VERSION=$(node -p \"require('./package.json').version\") && docker save gaming-music-bot:$VERSION -o music-discord-bot-$VERSION.tar",
"docker-build": "node docker-scripts.js build",
"docker-save": "node docker-scripts.js save",
"build-prod": "npm run build && npm run docker-build && npm run docker-save",
"release:patch": "npm version patch && npm run build-prod",
"release:minor": "npm version minor && npm run build-prod",
Expand Down