mirror of
https://github.com/darksaid98/cadence-discord-bot.git
synced 2026-12-03 14:38:49 +00:00
fix: Update Dockerfile and add .dockerignore
This commit is contained in:
1 parent
ac40865b1a
commit
054a07dd77
2 files changed
+43
-17
No files matched your search
+12
-17
@@ -1,30 +1,25 @@
|
||||
# Using Node 18.16.1 (LTS) on Alpine base
|
||||
FROM node:18.16-alpine
|
||||
# syntax=docker/dockerfile:1
|
||||
|
||||
# Using Node 18.16 (LTS) on Alpine base
|
||||
ARG NODE_VERSION=18.16
|
||||
FROM node:${NODE_VERSION}-alpine
|
||||
|
||||
# Install npm build dependencies and ffmpeg
|
||||
RUN apk add --no-cache python3 make build-base ffmpeg git
|
||||
|
||||
# Clone Cadence repository - Shallow clone used to avoid including entire git history.
|
||||
RUN git clone --depth 1 https://github.com/mariusbegby/cadence-discord-bot.git /cadence-discord-bot
|
||||
|
||||
# Set work directory for subsequent commands
|
||||
WORKDIR /cadence-discord-bot
|
||||
|
||||
# Copy the rest of the source files into the image.
|
||||
COPY . .
|
||||
|
||||
# Install dependencies from package-lock.json and omit dev dependencies
|
||||
RUN npm ci --omit=dev
|
||||
|
||||
# Remove unnecessary files
|
||||
RUN rm -rf /assets
|
||||
RUN rm -rf /.github
|
||||
|
||||
# Copy .env and config file to docker container
|
||||
# Do NOT share the built image with anyone as it will contain the .env file
|
||||
# Optionally skip this step and set environment variables manually
|
||||
COPY .env .env
|
||||
COPY *local.js config/local.js
|
||||
# Leverage a cache mount to /root/.npm to speed up subsequent builds.
|
||||
RUN --mount=type=cache,target=/root/.npm \
|
||||
npm ci --omit=dev
|
||||
|
||||
# Deploy Slash Commands to Discord API
|
||||
RUN npm run deploy
|
||||
|
||||
# Startup command to run the bot
|
||||
CMD [ "npm", "start" ]
|
||||
CMD [ "npm", "run", "start" ]
|
||||
Reference in new issue
Block a user