-
Notifications
You must be signed in to change notification settings - Fork 454
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #454 from gallexy/multiple-docker-images
Multiple docker images
- Loading branch information
Showing
5 changed files
with
75 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
docker-compose.yaml | ||
.env* | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: | ||
|