Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: Add build and publish pipeline by Docker #53

Merged
merged 3 commits into from
Mar 24, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Build the container image

on:
push:
branches:
- main
paths:
- Dockerfile
- src/**
- poetry.lock
- pyproject.toml

jobs:
build:
steps:
- name: Checkout the repo
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: amd64, arm64

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Github Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile
push: true
platforms: linux/amd64,linux/arm64
tags: |
ghcr.io/${{ github.repository }}/llm-assistant:latest
ghcr.io/${{ github.repository }}/llm-assistant:${{ github.sha }}
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.12 as build
FROM python:3.12-alpine as build
nqngo marked this conversation as resolved.
Show resolved Hide resolved

WORKDIR /app

Expand All @@ -10,13 +10,13 @@ ENV POETRY_NO_INTERACTION=1 \

RUN pip install poetry==${POETRY_VERSION}

COPY pyproject.toml poetry.lock ./
COPY pyproject.toml poetry.lock README.md ./
samhwang marked this conversation as resolved.
Show resolved Hide resolved
COPY src ./src

RUN poetry install --compile --without dev
RUN poetry build && poetry run pip install /app/dist/*.whl

FROM python:3.12-slim as runtime
FROM python:3.12-alpine as runtime

COPY --from=build /app/.venv /app/.venv

Expand Down
4 changes: 2 additions & 2 deletions src/discord_bot/bot.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import interactions
import re
import llm
from settings import Settings
from discord_bot import llm
from discord_bot.settings import Settings


MODEL_CHOICES = ["gpt-3.5-turbo", "gpt-4", "phi"]
Expand Down