docker
This commit is contained in:
parent
45ad916f61
commit
3872ddbb68
11
Dockerfile
Normal file
11
Dockerfile
Normal file
@ -0,0 +1,11 @@
|
||||
FROM node:22
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY package*.json /app/
|
||||
COPY src/ /app/src/
|
||||
COPY db/shop.db /app/shop.db
|
||||
|
||||
RUN npm install
|
||||
|
||||
CMD ["node", "src/index.js"]
|
BIN
db/shop.db
Normal file
BIN
db/shop.db
Normal file
Binary file not shown.
17
docker-compose.yml
Normal file
17
docker-compose.yml
Normal file
@ -0,0 +1,17 @@
|
||||
version: "3.3"
|
||||
|
||||
services:
|
||||
telegram_shop_prod:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: ./Dockerfile
|
||||
hostname: telegram_shop_prod
|
||||
container_name: telegram_shop_prod
|
||||
restart: always
|
||||
environment:
|
||||
- BOT_TOKEN=7626758249:AAEdcbXJpW1VsnJJtc8kZ5VBsYMFR242wgk
|
||||
- ADMIN_IDS=732563549,390431690
|
||||
- SUPPORT_LINK=https://t.me/neroworm
|
||||
- CATALOG_PATH=./catalog
|
||||
volumes:
|
||||
- ./db:/app/db/
|
@ -1,6 +1,6 @@
|
||||
export default {
|
||||
BOT_TOKEN: "7626758249:AAEdcbXJpW1VsnJJtc8kZ5VBsYMFR242wgk",
|
||||
ADMIN_IDS: ["732563549", "390431690"],
|
||||
SUPPORT_LINK: "https://t.me/neroworm",
|
||||
CATALOG_PATH: "./catalog"
|
||||
BOT_TOKEN: process.env.BOT_TOKEN,
|
||||
ADMIN_IDS: process.env.ADMIN_IDS.split(","),
|
||||
SUPPORT_LINK: process.env.SUPPORT_LINK,
|
||||
CATALOG_PATH: process.env.CATALOG_PATH
|
||||
};
|
@ -4,7 +4,7 @@ import { dirname } from 'path';
|
||||
import { fileURLToPath } from 'url';
|
||||
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||
const DB_PATH = new URL('../../shop.db', import.meta.url).pathname;
|
||||
const DB_PATH = new URL('../../db/shop.db', import.meta.url).pathname;
|
||||
|
||||
// Create database with verbose mode for better error reporting
|
||||
const db = new sqlite3.Database(DB_PATH, sqlite3.OPEN_CREATE | sqlite3.OPEN_READWRITE, (err) => {
|
||||
@ -243,8 +243,8 @@ const initDb = async () => {
|
||||
|
||||
// Initialize the database
|
||||
(async () => {
|
||||
await cleanUpInvalidForeignKeys();
|
||||
await initDb();
|
||||
await cleanUpInvalidForeignKeys();
|
||||
})().catch(error => {
|
||||
console.error('Database initialization failed:', error);
|
||||
process.exit(1);
|
||||
|
Loading…
Reference in New Issue
Block a user