Skip to content

Commit

Permalink
movie-detectives
Browse files Browse the repository at this point in the history
  • Loading branch information
qianniucity committed May 23, 2024
0 parents commit 7490017
Show file tree
Hide file tree
Showing 51 changed files with 4,652 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.venv/
movie-detectives-server_latest.tar.gz
21 changes: 21 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# 影片数据源
TMDB_API_KEY=XXX

# gemini 服务配置
GCP_PROJECT_ID=XXX
GCP_LOCATION=us-XXX
GCP_SERVICE_ACCOUNT_FILE=XXX.json

# Groq 服务配置
GROQ_API_KEY=XXX
GROQ_MODEL_NAME=llama3-70b-8192


# Ollama 服务配置
# OLLAMA_BASE_URL=http://127.0.0.1:11434 # 本地连接
# OLLAMA_BASE_URL=http://XXX:11434 # 外网连接
# OLLAMA_BASE_URL=XXXXXXXXX # 内网连接

# qwen 服务配置
QWEN_MODEL_NAME=qwen-long
QWEN_API_KEY=XXX
33 changes: 33 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Test and lint

on:
push:
branches:
- main

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest

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

- uses: actions/setup-python@v3
with:
python-version: "3.12"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry
poetry install
- name: Run tests
run: poetry run python -m unittest -v

- name: Lint
uses: chartboost/ruff-action@v1
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
__pycache__/
.venv/
movie-detectives-server_latest.tar.gz
.env
googlecloud_gemini.json
16 changes: 16 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/psf/black
rev: 22.10.0
hooks:
- id: black
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.5
hooks:
- id: ruff
- id: ruff-format
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"CodeGPT.apiKey": "Ollama"
}
21 changes: 21 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM --platform=linux/amd64 python:3.12-slim

# macos arm64
# FROM --platform=linux/arm64 python:3.12-slim

ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
PIP_NO_CACHE_DIR=off \
PIP_DISABLE_PIP_VERSION_CHECK=on \
PIP_DEFAULT_TIMEOUT=100 \
POETRY_CACHE_DIR=/tmp/poetry_cache

WORKDIR /workdir
COPY ./pyproject.toml /workdir/pyproject.toml
RUN pip3 install poetry==1.8.2
RUN poetry config virtualenvs.create false
RUN poetry install --no-dev && rm -rf $POETRY_CACHE_DIR

COPY . /workdir
EXPOSE 9091
CMD ["uvicorn", "api.main:app", "--host", "0.0.0.0", "--port", "9091"]
27 changes: 27 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
all:
@echo "see README.md"

.venv:
poetry install

.PHONY: run
run:
uvicorn api.main:app --reload

.PHONY: test
test:
python -m unittest -v

.PHONY: ruff
ruff:
ruff check --fix

.PHONY: clean
clean:
rm -rf movie-detectives-server_latest.tar.gz

.PHONY: build
build: clean
docker image rm movie-detectives-server
docker build -t movie-detectives-server .
docker save movie-detectives-server:latest | gzip > movie-detectives-server_latest.tar.gz
Loading

0 comments on commit 7490017

Please sign in to comment.