Skip to content

Commit

Permalink
Merge pull request #22 from wri/docker-build-publish
Browse files Browse the repository at this point in the history
Build docker image and publish to GHCR
  • Loading branch information
yellowcap authored Nov 27, 2024
2 parents 0da7f6b + be03db2 commit e67511d
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 4 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Build and Publish Docker Image

on:
push:
branches:
- main
- docker-build-publish

env:
REGISTRY: public.ecr.aws/b7u8b0a6
IMAGE_NAME: project-zeno/zeno

jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1

- name: Login to Amazon ECR Public
id: login-ecr-public
uses: aws-actions/amazon-ecr-login@v2
with:
registry-type: public

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}
29 changes: 29 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM python:3.12-slim-bookworm

# Set environment variables
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1

# The installer requires curl (and certificates) to download the release archive
RUN apt-get update && apt-get install -y --no-install-recommends curl ca-certificates \
&& rm -rf /var/lib/apt/lists/*

ADD https://astral.sh/uv/0.5.4/install.sh /uv-installer.sh

# Run the installer then remove it
RUN sh /uv-installer.sh && rm /uv-installer.sh

# Ensure the installed binary is on the `PATH`
ENV PATH="/root/.local/bin/:$PATH"

# Copy the project into the image
ADD . /app

# Sync the project into a new environment, using the frozen lockfile
WORKDIR /app

# Install the dependencies
RUN uv sync --frozen

# Command to run the application.
CMD ["uv", "run", "uvicorn", "api:app", "--reload"]
7 changes: 4 additions & 3 deletions zeno/agents/maingraph/utils/nodes.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import json

from langchain_core.messages import HumanMessage, SystemMessage
from langchain_ollama import ChatOllama
from langchain_ollama import ChatOllama # noqa
from langchain_anthropic import ChatAnthropic

llm_json_mode = ChatOllama(model="qwen2.5:7b", temperature=0, format="json")
# llm_json_mode = ChatAnthropic(model="claude-3-5-sonnet-20241022", temperature=0, format="json")
# llm_json_mode = ChatOllama(model="qwen2.5:7b", temperature=0, format="json")
llm_json_mode = ChatAnthropic(model="claude-3-5-sonnet-20241022", temperature=0)


def generate(state):
Expand Down
2 changes: 1 addition & 1 deletion zeno/tools/location/tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from zeno.tools.location.location_matcher import LocationMatcher

GADM_CSV_PATH = "../data/gadm.csv"
GADM_CSV_PATH = "data/gadm.csv"
location_matcher = LocationMatcher(GADM_CSV_PATH)


Expand Down

0 comments on commit e67511d

Please sign in to comment.