diff --git a/.dockerignore b/.dockerignore index 2aca7dfd6..4988fcde3 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,6 +1,9 @@ .DS_Store node_modules/ +.git/ .vscode/ +docs/ *.log *.tar.gz +*.tar .env \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 0e39295bf..23c01a0fd 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,7 +2,7 @@ version: "4" services: discord-js-bot: - image: saitejamadha/discord-js-bot:5.1.0 + image: saitejamadha/discord-js-bot:5.4.0 container_name: discord-js-bot restart: unless-stopped networks: diff --git a/dockerfile b/dockerfile index a6bbbc874..80ef6af71 100644 --- a/dockerfile +++ b/dockerfile @@ -1,13 +1,32 @@ +# Base image FROM node:16-alpine +# Set the working directory in the container WORKDIR /usr/src/app +# Copy package.json and package-lock.json to the container COPY package*.json ./ +# Install only production dependencies RUN npm ci --omit=dev +# Bundle rest of the source code COPY . . -EXPOSE 8080-8089 449 +# Environment variables +ENV BOT_TOKEN= +ENV MONGO_CONNECTION= +ENV ERROR_LOGS= +ENV JOIN_LEAVE_LOGS= +ENV BOT_SECRET= +ENV SESSION_PASSWORD= +ENV WEATHERSTACK_KEY= +ENV STRANGE_API_KEY= +ENV SPOTIFY_CLIENT_ID= +ENV SPOTIFY_CLIENT_SECRET= +# Expose port 8080 for dashboard +EXPOSE 8080 + +# Define the command to run your Node.js application CMD [ "node", "bot.js" ] diff --git a/package.json b/package.json index dc7654531..866c32280 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,8 @@ "scripts": { "dev": "nodemon .", "start": "node .", - "format": "prettier --write src" + "format": "prettier --write src", + "docker:build": "docker build -t saitejamadha/discord-js-bot:5.4.0 ." }, "homepage": "https://github.com/saiteja-madha/discord-js-bot#readme", "repository": {