Open kevinthedang opened 1 month ago
Did some extra thinking:
The Dockerfile
might have to change to allow the image to be usable unless there is a way to modify the image locally and allow a user to have their own BOT_TOKEN
and GUILD_ID
.
# use node LTS image for version 18
FROM node:hydrogen-alpine
# set working directory inside container
WORKDIR /app
# copy package.json and the lock file into the container, and src files
COPY ./src ./src
COPY ./*.json ./
COPY ./.env ./
# install dependencies, breaks
RUN npm install
# build the typescript code
RUN npm run build
# start the application
CMD ["npm", "run", "prod"]
Issue
BOT_TOKEN
orGUILD_ID
provided for the image to be usable.Solution
docker pull
documentationReferences
release.yml
file for pushing to docker hubjobs: Deploy-Image: runs-on: ubuntu-latest environment: release timeout-minutes: 3 steps:
name: Checkout Repository uses: actions/checkout@v4
name: Set up Node Environment lts/hydrogen uses: actions/setup-node@v4 with: node-version: lts/hydrogen cache: "npm"
name: Create Environment Variables run: | touch .env echo CLIENT_TOKEN = NOT_REAL_TOKEN >> .env echo GUILD_ID = 123456 >> .env echo MODEL = ${{ secrets.MODEL }} >> .env echo CLIENT_UID = ${{ secrets.CLIENT_UID }} >> .env echo OLLAMA_IP = ${{ secrets.OLLAMA_IP }} >> .env echo OLLAMA_PORT = ${{ secrets.OLLAMA_PORT }} >> .env
name: Get Version from package.json run: echo "VERSION=$(jq -r '.version' package.json)" >> $GITHUB_ENV
name: Build Image run: | npm run docker:build
name: Build Image as Latest run: | npm run docker:build-latest
name: Log into Docker run: | docker login --username ${{ vars.DOCKER_USER }} --password ${{ secrets.DOCKER_PASS }}
name: Release Docker Image run: | docker push ${{ vars.DOCKER_USER }}/discord-ollama:${{ env.VERSION }} docker push ${{ vars.DOCKER_USER }}/discord-ollama:latest