added docker files

This commit is contained in:
Lukian LEIZOUR 2024-03-10 18:38:26 +01:00
parent 3ecff54a1d
commit d1f5afed9a
5 changed files with 24 additions and 4 deletions

4
DOCKERFILE Normal file
View file

@ -0,0 +1,4 @@
FROM node:latest
WORKDIR /app
COPY . /app
CMD ["npm", "run", "start"]

View file

@ -17,3 +17,8 @@
- Run `npm run dev` to run the dev mode - Run `npm run dev` to run the dev mode
- Tun `npm run build` to build the project - Tun `npm run build` to build the project
- Run `npm run start` to run the compiled code - Run `npm run start` to run the compiled code
## Docker configuration
- Change the service name and the full path to your bot in `docker-compose.yml` file
- Run `docker compose up` to run the container

10
docker-compose.yml Normal file
View file

@ -0,0 +1,10 @@
version: '3.1'
services:
service_name:
build:
context: .
dockerfile: DOCKERFILE
restart: always
volumes:
- /full/path/to/bot:/app

View file

@ -5,7 +5,8 @@
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
"dev": "tsx watch src", "dev": "tsx watch src",
"build": "tsc" "build": "tsc",
"start": "node dist"
}, },
"keywords": [], "keywords": [],
"author": "", "author": "",

View file

@ -17,7 +17,7 @@ for (const folder of commandFolders) {
const commandsPath = path.join(foldersPath, folder); const commandsPath = path.join(foldersPath, folder);
const commandFiles = fs const commandFiles = fs
.readdirSync(commandsPath) .readdirSync(commandsPath)
.filter((file) => file.endsWith(".ts")); .filter((file) => file.endsWith(".ts") || file.endsWith(".js"));
for (const file of commandFiles) { for (const file of commandFiles) {
const filePath = path.join(commandsPath, file); const filePath = path.join(commandsPath, file);
@ -52,7 +52,7 @@ const rest = new REST().setToken(process.env.DISCORD_TOKEN ? process.env.DISCORD
const eventsPath = path.join(__dirname, "events"); const eventsPath = path.join(__dirname, "events");
const eventFiles = fs const eventFiles = fs
.readdirSync(eventsPath) .readdirSync(eventsPath)
.filter((file) => file.endsWith(".ts")); .filter((file) => file.endsWith(".ts") || file.endsWith(".js"));
for (const file of eventFiles) { for (const file of eventFiles) {
const filePath = path.join(eventsPath, file); const filePath = path.join(eventsPath, file);