mirror of
https://github.com/discordeno/discordeno.git
synced 2026-09-17 08:47:22 +00:00
feat(examples): Migrate example bots to discordeno v19 (#3647)
* Migrate beginner and minimal bot to discordeno v19
* Add .swcrc and fix minimal yarn.lock
* update .gitignore files
* Update nodejs template
Discordeno.js (DD v13) -> DD v19 "raw"
Currently the permission checking is not working correctly
* Fix permission issue
* Rename the templates
* remove unused indents
* Rename starter to beginner
So now it is minimal (main branch) -> beginner
* Really small refactor & eslint fixes (bigbot template)
This is to make my life less miserable at a later time
* mark rabbitMQ plugins as binary files
git seems to be treating them as text
* Add v19 bigbot rest
* Add gateway code
and rabbitmq_message_deduplication v0.6.2 plugin
* fix yarn messy semevr version for @types/amqplib
* clear channel con amqp connection close
* Add bot code for bigbot v19
missing prisma setup, collector setup & language setup
* Add localization
The "command versioning" system works the same say as before, but instead of a command version the code updates the commands every time they change based on the SHA1 of the commands
* Use file relative paths instead of cwd relative paths
* Fix todos
* revert autocomplete tests
* Revert "Add localization"
This reverts commit 2b1da8d2cd.
* move env assertion to config.ts
* Add shard ping to /ping
* fix small issue
* Update readme files
* use Date.now() for the bigbot REST ping
* Remove bigbot v16 code
* Add docker (compose) setup to bigbot template
* remove healthchecks from rest & gateway
* Update dependencies of examples
* Apply readme(s) suggestions from code review
Hopefully i haven't missed any related to markdown files
Co-authored-by: LTS20050703 <lts20050703@gmail.com>
* Apply code suggestions from code review
Co-authored-by: LTS20050703 <lts20050703@gmail.com>
---------
Co-authored-by: LTS20050703 <lts20050703@gmail.com>
This commit is contained in:
+68
-30
@@ -1,37 +1,75 @@
|
||||
FROM node:16.18.0-alpine3.16 AS deps
|
||||
WORKDIR /app
|
||||
COPY package.json package-lock.json .swcrc ./
|
||||
RUN npm install
|
||||
# syntax=docker/dockerfile:1
|
||||
|
||||
FROM node:16.18.0-alpine3.16 as rest
|
||||
COPY --from=deps /app /app
|
||||
WORKDIR /app
|
||||
COPY src/analytics.ts src/configs.ts src/
|
||||
COPY src/rest src/rest
|
||||
RUN npm run build
|
||||
ARG NODE_VERSION=20
|
||||
|
||||
################################################################################
|
||||
|
||||
FROM node:${NODE_VERSION}-alpine as base
|
||||
|
||||
# Set working directory for all build stages.
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
# Enable corepack so it can install the needed yarn version
|
||||
RUN corepack enable
|
||||
|
||||
COPY package.json .
|
||||
COPY yarn.lock .
|
||||
# We need to copy the yarnrc or else yarn will attempt to use PnP
|
||||
COPY .yarnrc.yml .
|
||||
|
||||
RUN yarn install
|
||||
|
||||
# Copy the rest of the source files into the image.
|
||||
COPY . .
|
||||
|
||||
# Run the build script.
|
||||
RUN yarn build
|
||||
|
||||
# Use production node environment by default.
|
||||
ENV NODE_ENV production
|
||||
|
||||
# Run the application as a non-root user.
|
||||
USER node
|
||||
|
||||
################################################################################
|
||||
|
||||
FROM base as rest
|
||||
|
||||
# Expose the port that the application listens on.
|
||||
EXPOSE 8000
|
||||
CMD ["npm","run","startr"]
|
||||
|
||||
FROM node:16.18.0-alpine3.16 as gateway
|
||||
COPY --from=deps /app /app
|
||||
WORKDIR /app
|
||||
COPY src/configs.ts src/
|
||||
COPY src/gateway src/gateway
|
||||
RUN npm run build
|
||||
# Run the application.
|
||||
CMD node dist/rest/index.js
|
||||
|
||||
################################################################################
|
||||
|
||||
FROM base as gateway
|
||||
|
||||
# Expose the port that the application listens on.
|
||||
EXPOSE 8080
|
||||
CMD ["npm","run","startg"]
|
||||
|
||||
FROM node:16.18.0-alpine3.16 as bot
|
||||
COPY --from=deps /app /app
|
||||
WORKDIR /app
|
||||
COPY prisma prisma
|
||||
COPY node_modules/.prisma/client node_modules/.prisma/client
|
||||
COPY src/analytics.ts src/prisma.ts src/configs.ts src/
|
||||
COPY src/bot src/bot
|
||||
RUN npm run build
|
||||
EXPOSE 8080
|
||||
CMD ["npm","run","startb"]
|
||||
# Run the application.
|
||||
CMD node dist/gateway/index.js
|
||||
|
||||
FROM rabbitmq:3.11.2-management-alpine as rabbitmq
|
||||
COPY src/rabbitmq/plugins plugins
|
||||
################################################################################
|
||||
|
||||
FROM base as bot
|
||||
|
||||
# Expose the port that the application listens on.
|
||||
EXPOSE 8081
|
||||
|
||||
# Run the application.
|
||||
CMD node dist/bot/index.js
|
||||
|
||||
################################################################################
|
||||
|
||||
FROM rabbitmq:3.12-management-alpine as rabbitmq
|
||||
|
||||
# Copy the rabbitmq plugins
|
||||
COPY rabbitmq/plugins/** plugins
|
||||
|
||||
HEALTHCHECK CMD [ "rabbitmq-diagnostics", "-q", "status" ] \
|
||||
--interval=30s --timeout=30s --start-period=30s --retries=5
|
||||
|
||||
# Enable the required plugins
|
||||
RUN rabbitmq-plugins enable rabbitmq_message_deduplication
|
||||
|
||||
Reference in New Issue
Block a user