29
Dockerfile
29
Dockerfile
@@ -1,20 +1,35 @@
|
|||||||
# Use an official Node runtime as the parent image
|
# Use an official Node runtime as the parent image
|
||||||
FROM node:18
|
FROM node:18-slim
|
||||||
|
|
||||||
# Set the working directory in the container
|
# Create app directory
|
||||||
WORKDIR /usr/src/app
|
WORKDIR /usr/src/app
|
||||||
|
|
||||||
# Copy package.json and package-lock.json
|
# Install app dependencies
|
||||||
|
# A wildcard is used to ensure both package.json AND package-lock.json are copied
|
||||||
COPY package*.json ./
|
COPY package*.json ./
|
||||||
|
|
||||||
# Install dependencies
|
# Install dependencies
|
||||||
RUN npm install
|
RUN npm ci --only=production
|
||||||
|
|
||||||
# Copy the rest of your app's source code
|
# Bundle app source
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
# Your app binds to port 3000 so you'll use the EXPOSE instruction to have it mapped by the docker daemon
|
# Create a non-root user with system UID
|
||||||
|
RUN addgroup --system --gid 999 nodejs && \
|
||||||
|
adduser --system --uid 999 --ingroup nodejs --no-create-home nodejs && \
|
||||||
|
chown -R nodejs:nodejs /usr/src/app
|
||||||
|
|
||||||
|
USER nodejs
|
||||||
|
|
||||||
|
# Your app binds to port 3000
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
|
|
||||||
# Define the command to run your app
|
# Add simple healthcheck
|
||||||
|
HEALTHCHECK --interval=30s --timeout=3s \
|
||||||
|
CMD node -e "process.exit(0)"
|
||||||
|
|
||||||
|
# Define environment variable
|
||||||
|
ENV NODE_ENV=production
|
||||||
|
|
||||||
|
# Start the app
|
||||||
CMD [ "node", "index.js" ]
|
CMD [ "node", "index.js" ]
|
||||||
@@ -73,10 +73,10 @@ class Bot {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
if (interaction.isCommand()) {
|
if (interaction.isCommand()) {
|
||||||
// Remove ephemeral flag for finduser and matchhistory commands
|
// Remove ephemeral flag for finduser, matchhistory, and findteam commands
|
||||||
const isStatsCommand = ['finduser', 'matchhistory'].includes(interaction.commandName);
|
const isPublicCommand = ['finduser', 'matchhistory', 'findteam'].includes(interaction.commandName);
|
||||||
await interaction.deferReply({
|
await interaction.deferReply({
|
||||||
ephemeral: !isStatsCommand
|
ephemeral: !isPublicCommand
|
||||||
});
|
});
|
||||||
|
|
||||||
this.logger.debug('Processing command', {
|
this.logger.debug('Processing command', {
|
||||||
|
|||||||
Reference in New Issue
Block a user