Skip to content

Commit

Permalink
Merge pull request #454 from gallexy/multiple-docker-images
Browse files Browse the repository at this point in the history
Multiple docker images
  • Loading branch information
sugarforever authored May 17, 2024
2 parents 7ee8ec2 + ea23e22 commit 2464f95
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 25 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
docker-compose.yaml
.env*
node_modules
59 changes: 37 additions & 22 deletions .github/workflows/docker-image.yaml
Original file line number Diff line number Diff line change
@@ -1,32 +1,47 @@
name: Docker Image CI

name: Build and push Docker Images for multiple platforms


on:
push:
branches: [ "main" ]
tags:
- "*"
workflow_dispatch:

jobs:
build:
build_and_push:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- uses: actions/checkout@v4

# 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
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Cache Docker layers
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64/v8
push: true
tags: ${{ github.repository }}:latest
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache


4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
ARG NODE_VERSION=20.12.2
ARG NODE_VERSION=20.13.1

FROM node:${NODE_VERSION}-slim

RUN apt-get update && apt-get install -y openssl
RUN apt-get update && apt-get install -y openssl iputils-ping net-tools

WORKDIR /app

Expand Down
3 changes: 2 additions & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: '3.1'
services:
chromadb:
image: chromadb/chroma
Expand All @@ -18,6 +17,8 @@ services:
- COHERE_BASE_URL=http://peanutshell:8000/v1
image: 0001coder/chatollama:latest
pull_policy: always
extra_hosts:
- "host.docker.internal:host-gateway"
ports:
- "3000:3000"
restart: always
Expand Down
33 changes: 33 additions & 0 deletions docker-compose_arm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
services:
chromadb:
image: chromadb/chroma
ports:
- "8000:8000"
restart: always
volumes:
- chromadb_data:/chroma/.chroma/index

chatollama:
environment:
- CHROMADB_URL=http://chromadb:8000
- DATABASE_URL=file:/app/sqlite/chatollama.sqlite
- REDIS_HOST=redis
image: chatollama:latest
extra_hosts:
- "host.docker.internal:host-gateway"
ports:
- "3000:3000"
restart: always
volumes:
- ~/.chatollama:/app/sqlite

redis:
image: redis:latest
restart: always
volumes:
- redis_data:/data

volumes:
chromadb_data:
redis_data:

0 comments on commit 2464f95

Please sign in to comment.