diff --git a/.dockerignore b/.dockerignore index 2cfaf4bf..4625797e 100644 --- a/.dockerignore +++ b/.dockerignore @@ -6,12 +6,13 @@ **/logs **/bot-help **/bot-temp -**/config +**/docs **/data +**/dist **/.cache *.log npm-debug.log* yarn-debug.log* yarn-error.log* -*.sqlite \ No newline at end of file +*.sqlite* \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 0ec8f3ca..783c09c5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -58,9 +58,9 @@ RUN git clone https://github.com/ImageMagick/ImageMagick.git ~/ImageMagick \ RUN cp -a /built/* /usr FROM native-build-${MAGICK} AS build -RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --no-optional --frozen-lockfile +RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile # Detect ImageMagick usage and adjust build accordingly -RUN if [[ "$MAGICK" -eq "1" ]] ; then pnpm run build ; else pnpm run build:no-magick ; fi +RUN if [[ "$MAGICK" -eq "1" ]] ; then pnpm run build --CDWITH_BACKWARD=OFF ; else pnpm run build:no-magick --CDWITH_BACKWARD=OFF ; fi FROM native-build-${MAGICK} AS prod-deps RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --no-optional --frozen-lockfile @@ -70,9 +70,11 @@ COPY --from=prod-deps /app/node_modules /app/node_modules COPY --from=build /app/build/Release /app/build/Release COPY --from=build /built /usr RUN rm .env +RUN rm -rf config src natives +RUN mkdir /app/config && chmod 777 /app/config RUN mkdir /app/help && chmod 777 /app/help RUN mkdir /app/temp && chmod 777 /app/temp RUN mkdir /app/logs && chmod 777 /app/logs -ENTRYPOINT ["node", "app.js"] +ENTRYPOINT ["node", "dist/app.js"] diff --git a/package.json b/package.json index 825877db..7a0b91d9 100644 --- a/package.json +++ b/package.json @@ -10,14 +10,17 @@ }, "scripts": { "build": "tsc && pnpm build:natives", + "build:no-magick": "tsc && pnpm build:natives:no-magick", "build:debug": "tsc && pnpm build:natives:debug", + "build:debug-no-magick": "tsc && pnpm build:natives:debug-no-magick", "build:natives": "cmake-js compile --CDWITH_MAGICK=ON", "build:natives:debug": "cmake-js compile -BDebug --CDWITH_MAGICK=ON", "build:natives:no-magick": "cmake-js compile --CDWITH_MAGICK=OFF", "build:natives:debug-no-magick": "cmake-js compile -BDebug --CDWITH_MAGICK=OFF", + "build:ts": "tsc", "docker:build": "DOCKER_BUILDKIT=1 docker build -t esmbot .", "docker:run-bot": "docker run --rm --network=host esmbot", - "docker:run-api": "docker run --rm --network=host --entrypoint='[\"node\", \"api/index.js\"]' esmbot", + "docker:run-api": "docker run --rm --network=host --entrypoint='[\"node\", \"dist/api/index.js\"]' esmbot", "docker:run-lava": "docker run --rm --network host -v \"$(pwd)\"/application.yml:/opt/Lavalink/application.yml ghcr.io/lavalink-devs/lavalink:4", "lint": "eslint .", "start": "node dist/app.js",