1
0

add dockerfile and build file

This commit is contained in:
2024-07-17 22:21:40 +02:00
parent 6e802434db
commit 436ba4a36b
3 changed files with 52 additions and 0 deletions

View File

@ -0,0 +1,27 @@
name: Role Wizard discord bot build and push
on:
push:
branches:
- release
jobs:
discord-bot-build:
runs-on: ubuntu-22.04
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
steps:
- name: Build
run: npm run dockerBuild
- name: Login to registry
uses: docker/login-action@v1
with:
registry: gitea.amundsson.eu
username: namundsson@gmail.com
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Build and push Docker image
run: |
docker build -t gitea.amundsson.eu/n1jos/role-wizard-discord-bot:latest .
docker push gitea.amundsson.eu/n1jos/role-wizard-discord-bot:latest

21
Dockerfile Normal file
View File

@ -0,0 +1,21 @@
FROM node:22
COPY build/ /home/node/app
ENTRYPOINT ["node", "build/index.js"]
FROM node:22 as builder
COPY . /src/
WORKDIR /src/
RUN npm install
RUN npm run build
RUN cp package.json ./build/package.json
RUN cp package-lock.json ./build/package-lock.json
RUN cd build && npm ci --production
RUN rm package.json && rm package-lock.json
FROM node:22 as runner
COPY --from=builder /src/build/ /home/node/app
ENTRYPOINT [ "node", "/home/node/app/index.js" ]

View File

@ -9,6 +9,7 @@
"registerCommands": "npx ts-node src/register-commands.ts",
"start": "yarn clean && yarn build && yarn registerCommands && yarn runBot",
"startNoClean": "yarn build && yarn runBot",
"dockerBuild": "npm run clean && npm run build && yarn run registerCommands",
"runBot": "node build/index.js"
},
"keywords": [],
@ -17,5 +18,8 @@
"dependencies": {
"discord.js": "^14.14.1",
"dotenv": "^16.4.5"
},
"devDependencies": {
"typescript": "^5.4.5"
}
}