From 60491931d3ceb6245bff9726809fa5ea641c8af5 Mon Sep 17 00:00:00 2001 From: sugarforever Date: Tue, 5 Mar 2024 10:30:32 +0000 Subject: [PATCH] Dockerfile and build pipeline --- .github/workflows/docker-image.yaml | 33 +++++++++++++++++++++++++++++ Dockerfile | 19 +++++++++++++++++ package.json | 1 + pnpm-lock.yaml | 9 +++++--- 4 files changed, 59 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/docker-image.yaml create mode 100644 Dockerfile diff --git a/.github/workflows/docker-image.yaml b/.github/workflows/docker-image.yaml new file mode 100644 index 0000000..13400c4 --- /dev/null +++ b/.github/workflows/docker-image.yaml @@ -0,0 +1,33 @@ +name: Docker Image CI + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + # Generate a timestamp and store it in a variable + - name: Generate Timestamp + id: timestamp + run: echo "::set-output name=timestamp::$(date +%s)" + + - name: Build the Docker image + run: | + TIMESTAMP="${{ steps.timestamp.outputs.timestamp }}" + docker build . --file Dockerfile --tag 0001coder/chatollama:${TIMESTAMP} + docker tag 0001coder/chatollama:${TIMESTAMP} 0001coder/chatollama:latest + - name: Log in to Docker Hub + run: docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} + + - name: Push Docker image to registry + run: | + TIMESTAMP="${{ steps.timestamp.outputs.timestamp }}" + docker push 0001coder/chatollama:${TIMESTAMP} + docker push 0001coder/chatollama:latest diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..ca8d049 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +ARG NODE_VERSION=20.5.1 + +FROM node:${NODE_VERSION}-slim + +WORKDIR /app + +COPY pnpm-lock.yaml package.json ./ + +RUN npm install -g pnpm + +RUN pnpm i + +COPY . . + +RUN pnpm run build + +EXPOSE 3000 + +CMD ["node", ".output/server/index.mjs"] diff --git a/package.json b/package.json index 8288f64..b9fc1c2 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,7 @@ "vue-router": "^4.2.5" }, "dependencies": { + "@iconify-json/heroicons": "^1.1.20", "@langchain/community": "^0.0.33", "@langchain/core": "^0.1.40", "@langchain/openai": "^0.0.15", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 69c8551..c497b61 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -5,6 +5,9 @@ settings: excludeLinksFromLockfile: false dependencies: + '@iconify-json/heroicons': + specifier: ^1.1.20 + version: 1.1.20 '@langchain/community': specifier: ^0.0.33 version: 0.0.33(chromadb@1.8.1)(ws@8.16.0) @@ -873,8 +876,8 @@ packages: vue: 3.4.15 dev: false - /@iconify-json/heroicons@1.1.19: - resolution: {integrity: sha512-uW2F9vdGll59W21ocBl+wR4Ve+/1CsmzBqPTuOaR3CbKzqnJKwzGASvC4Op0uTieFVWfBaevnzcRxwNo73J29g==} + /@iconify-json/heroicons@1.1.20: + resolution: {integrity: sha512-puNt1al/rDw8Rb5x8sfk20UA8AQjMskLMh63nSUBj+8I0lQ7LtX+0Qn8wow2xTXTEsynJ9xXLD8Aat53e0qi8A==} dependencies: '@iconify/types': 2.0.0 dev: false @@ -1573,7 +1576,7 @@ packages: '@egoist/tailwindcss-icons': 1.7.4(tailwindcss@3.4.1) '@headlessui/tailwindcss': 0.2.0(tailwindcss@3.4.1) '@headlessui/vue': 1.7.16(vue@3.4.15) - '@iconify-json/heroicons': 1.1.19 + '@iconify-json/heroicons': 1.1.20 '@nuxt/kit': 3.10.0 '@nuxtjs/color-mode': 3.3.2 '@nuxtjs/tailwindcss': 6.11.2