Some checks failed
Build and Publish Docker Images / build-and-push (push) Failing after 11m20s
Test Docker Compose Setup / test-compose (push) Failing after 54s
Test Docker Compose Setup / lint-dockerfiles (push) Failing after 30s
Test Docker Compose Setup / validate-compose (push) Failing after 16s
Build and Publish Docker Images / security-scan (push) Has been skipped
Build and Publish Docker Images / notify (push) Failing after 15s
33 lines
770 B
Docker
33 lines
770 B
Docker
# Use Node.js 18 Alpine for smaller image size
|
|
FROM node:18-alpine
|
|
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# Copy package files
|
|
COPY package.json ./
|
|
|
|
# Install dependencies (npm install works without package-lock.json)
|
|
RUN npm install --omit=dev --no-audit --no-fund && npm cache clean --force
|
|
|
|
# Copy application code
|
|
COPY . .
|
|
|
|
# Create non-root user for security
|
|
RUN addgroup -g 1001 -S nodejs && \
|
|
adduser -S discordbot -u 1001
|
|
|
|
# Change ownership of the app directory
|
|
RUN chown -R discordbot:nodejs /app
|
|
USER discordbot
|
|
|
|
# Expose port (if needed for health checks)
|
|
EXPOSE 3000
|
|
|
|
# Health check
|
|
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
|
CMD node -e "console.log('Bot is running')" || exit 1
|
|
|
|
# Start the bot
|
|
CMD ["node", "index.js"]
|