mirror of
https://github.com/darksaid98/cadence-discord-bot.git
synced 2026-12-02 14:38:49 +00:00
fix: update Dockerfile and CI/CD workflows
This commit is contained in:
1 parent
7185fe4071
commit
f21bfbae6f
5 files changed
+33
-22
No files matched your search
@@ -12,6 +12,17 @@ jobs:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Setup Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
|
||||
- name: Cache Docker layers
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: /tmp/.buildx-cache
|
||||
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-buildx-
|
||||
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
@@ -22,8 +33,10 @@ jobs:
|
||||
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
|
||||
|
||||
- name: Build and Push Docker Image
|
||||
run: |
|
||||
docker build -t mariusbegby/cadence:${{ env.RELEASE_VERSION }} .
|
||||
docker tag mariusbegby/cadence:${{ env.RELEASE_VERSION }} mariusbegby/cadence:latest
|
||||
docker push mariusbegby/cadence:${{ env.RELEASE_VERSION }}
|
||||
docker push mariusbegby/cadence:latest
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
tags: mariusbegby/cadence:${{ env.RELEASE_VERSION }}, mariusbegby/cadence:latest
|
||||
cache-from: type=local,src=/tmp/.buildx-cache
|
||||
cache-to: type=local,dest=/tmp/.buildx-cache
|
||||
@@ -26,5 +26,6 @@ jobs:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
cache: 'npm'
|
||||
- run: npm install -g npm@latest
|
||||
- run: npm ci --legacy-peer-deps
|
||||
- run: npm ci
|
||||
- run: npm run eslint
|
||||
- run: npm run build
|
||||
+11
-3
@@ -13,16 +13,24 @@ RUN apk add --no-cache python3 make build-base ffmpeg
|
||||
WORKDIR /cadence-discord-bot
|
||||
|
||||
# Copy the rest of the source files into the image.
|
||||
COPY . .
|
||||
COPY package*.json ./
|
||||
COPY tsconfig.json ./
|
||||
COPY src/ ./src/
|
||||
COPY config/ ./config/
|
||||
|
||||
# Install dependencies from package-lock.json and omit dev dependencies
|
||||
# Leverage a cache mount to /root/.npm to speed up subsequent builds.
|
||||
RUN --mount=type=cache,target=/root/.npm \
|
||||
npm ci
|
||||
|
||||
# Transpile TypeScript to JavaScript, remove dev dependencies, and install production dependencies
|
||||
RUN npm run build && \
|
||||
rm -rf node_modules && \
|
||||
npm ci --omit=dev
|
||||
|
||||
# Cleanup of unneeded packages and apk cache
|
||||
# Cleanup of unneeded packages, apk cache, and TypeScript source files
|
||||
RUN apk del python3 make build-base && \
|
||||
rm -rf /var/cache/apk/* /tmp/*
|
||||
rm -rf /var/cache/apk/* /tmp/* ./src/
|
||||
|
||||
# Startup command to run the bot after deploying slash commands
|
||||
CMD /bin/sh -c "npm run deploy && npm run start"
|
||||
Generated
-11
@@ -28,7 +28,6 @@
|
||||
"@types/config": "^3.3.0",
|
||||
"@types/node": "^20.5.6",
|
||||
"@types/node-os-utils": "^1.3.1",
|
||||
"@types/pino": "^7.0.5",
|
||||
"@types/uuid": "^9.0.2",
|
||||
"@typescript-eslint/eslint-plugin": "^6.4.1",
|
||||
"eslint": "^8.47.0",
|
||||
@@ -480,16 +479,6 @@
|
||||
"integrity": "sha512-gokG1AaQo78X3f1KXOPAfwbhERX95XL0nhosOhwFck0hZ3BG52Mfch3oj3gAhXuUsou3lwi+ewZWjDo0wshKwQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@types/pino": {
|
||||
"version": "7.0.5",
|
||||
"resolved": "https://registry.npmjs.org/@types/pino/-/pino-7.0.5.tgz",
|
||||
"integrity": "sha512-wKoab31pknvILkxAF8ss+v9iNyhw5Iu/0jLtRkUD74cNfOOLJNnqfFKAv0r7wVaTQxRZtWrMpGfShwwBjOcgcg==",
|
||||
"deprecated": "This is a stub types definition. pino provides its own type definitions, so you do not need this installed.",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"pino": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/prettier": {
|
||||
"version": "2.7.3",
|
||||
"resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-2.7.3.tgz",
|
||||
|
||||
+2
-2
@@ -24,7 +24,8 @@
|
||||
"start-pretty-no-ignore": "node ./dist/index.js | pino-pretty",
|
||||
"deploy": "node ./dist/utils/deploySlashCommands.js",
|
||||
"deploy-pretty": "node ./dist/utils/deploySlashCommands.js | pino-pretty --ignore environment,source,module,action,name,context,executionId,shardId,guildId",
|
||||
"eslint": "eslint ./src"
|
||||
"eslint": "eslint ./src",
|
||||
"build": "tsc"
|
||||
},
|
||||
"dependencies": {
|
||||
"@discord-player/extractor": "^4.4.2-dev.1",
|
||||
@@ -46,7 +47,6 @@
|
||||
"@types/config": "^3.3.0",
|
||||
"@types/node": "^20.5.6",
|
||||
"@types/node-os-utils": "^1.3.1",
|
||||
"@types/pino": "^7.0.5",
|
||||
"@types/uuid": "^9.0.2",
|
||||
"@typescript-eslint/eslint-plugin": "^6.4.1",
|
||||
"eslint": "^8.47.0",
|
||||
|
||||
Reference in new issue
Block a user