add dockerfile and build file
This commit is contained in:
27
.gitea/workflows/build.yaml
Normal file
27
.gitea/workflows/build.yaml
Normal 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
21
Dockerfile
Normal 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" ]
|
@ -9,6 +9,7 @@
|
|||||||
"registerCommands": "npx ts-node src/register-commands.ts",
|
"registerCommands": "npx ts-node src/register-commands.ts",
|
||||||
"start": "yarn clean && yarn build && yarn registerCommands && yarn runBot",
|
"start": "yarn clean && yarn build && yarn registerCommands && yarn runBot",
|
||||||
"startNoClean": "yarn build && yarn runBot",
|
"startNoClean": "yarn build && yarn runBot",
|
||||||
|
"dockerBuild": "npm run clean && npm run build && yarn run registerCommands",
|
||||||
"runBot": "node build/index.js"
|
"runBot": "node build/index.js"
|
||||||
},
|
},
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
@ -17,5 +18,8 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"discord.js": "^14.14.1",
|
"discord.js": "^14.14.1",
|
||||||
"dotenv": "^16.4.5"
|
"dotenv": "^16.4.5"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"typescript": "^5.4.5"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user