chore(docker): switch to pnpm, update Dockerfile, docker-compose, and README

This commit is contained in:
Jose Daniel G. Percy 2025-04-23 23:27:29 +08:00
parent 170faf7d01
commit 95ea55d972
3 changed files with 9 additions and 19 deletions

View File

@ -1,23 +1,15 @@
# Use official Node.js LTS image
FROM node:18-alpine FROM node:18-alpine
# Create app directory
WORKDIR /app WORKDIR /app
# Install build dependencies and copy manifest RUN apk add --no-cache python3 make g++ pnpm
RUN apk add --no-cache python3 make g++
COPY package.json pnpm-lock.yaml ./ COPY package.json pnpm-lock.yaml ./
# Install dependencies RUN pnpm install --frozen-lockfile
RUN npm ci
# Copy source code
COPY . . COPY . .
# Expose no ports (Discord bot)
# Define default environment variables (optional)
ENV NODE_ENV=production ENV NODE_ENV=production
# Start the bot CMD [node, src/index.js]
CMD ["node", "src/index.js"]

View File

@ -31,15 +31,15 @@ Discord music bot template written in NodeJS using `discord.js` and `erela.js`,
``` ```
3. Run tests: 3. Run tests:
```sh ```sh
npm test pnpm test
``` ```
4. Register slash commands: 4. Register slash commands:
```sh ```sh
npm start # or node deploy-commands.js pnpm start # or node deploy-commands.js
``` ```
5. Start the bot: 5. Start the bot:
```sh ```sh
npm start pnpm start
``` ```
## Docker ## Docker

View File

@ -1,16 +1,13 @@
version: '3.8'
services: services:
lavalink: lavalink:
image: jagrosh/lavalink:latest image: fredboat/lavalink:latest
container_name: lavalink container_name: lavalink
ports: ports:
- "2333:2333" - "2333:2333"
environment: environment:
- LAVALINK_PASSWORD=${LAVALINK_PASSWORD} - LAVALINK_PASSWORD=${LAVALINK_PASSWORD}
volumes: volumes:
# Optional: mount custom configuration if needed - ./application.yml:/opt/Lavalink/application.yml:ro,Z
# - ./application.yml:/opt/Lavalink/application.yml
bot: bot:
build: . build: .
@ -20,5 +17,6 @@ services:
environment: environment:
- LAVALINK_HOST=lavalink - LAVALINK_HOST=lavalink
- LAVALINK_PORT=2333 - LAVALINK_PORT=2333
- LAVALINK_PASSWORD=${LAVALINK_PASSWORD}
depends_on: depends_on:
- lavalink - lavalink