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

Initialize Project #5

Merged
merged 4 commits into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
61 changes: 61 additions & 0 deletions .github/workflows/docker-image-ai-core.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: AI Core Docker Image CI

on:
push:
paths:
- 'backend/ai-service/**'
branches:
- 'main'
release:
types: [ published ]

env:
IMAGE_NAME: 'samepaage/samepage-ai-core'
DOCKERFILE: './backend/ai-service/Dockerfile'

jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

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

- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.IMAGE_NAME }}
tags: |
type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/') }}
type=ref,event=branch
type=sha,enable=true,priority=100,prefix=,suffix=,format=long
type=raw,value=${{ github.ref_name }},enable=${{ startsWith(github.ref, 'refs/tags/') }}

- name: Build and push
uses: docker/build-push-action@v5
with:
file: ${{ env.DOCKERFILE }}
platforms: |
linux/amd64
linux/arm64
build-args: |
COMMIT_SHA=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
61 changes: 61 additions & 0 deletions .github/workflows/docker-image-api.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Api Docker Image CI

on:
push:
paths:
- 'backend/management-service/**'
branches:
- 'main'
release:
types: [ published ]

env:
IMAGE_NAME: 'samepaage/samepage-api'
DOCKERFILE: './backend/management-service/Dockerfile'

jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

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

- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.IMAGE_NAME }}
tags: |
type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/') }}
type=ref,event=branch
type=sha,enable=true,priority=100,prefix=,suffix=,format=long
type=raw,value=${{ github.ref_name }},enable=${{ startsWith(github.ref, 'refs/tags/') }}

- name: Build and push
uses: docker/build-push-action@v5
with:
file: ${{ env.DOCKERFILE }}
platforms: |
linux/amd64
linux/arm64
build-args: |
COMMIT_SHA=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
78 changes: 78 additions & 0 deletions .github/workflows/docker-image-web.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Web Docker Image CI

on:
push:
paths:
- 'frontend/**'
branches:
- 'main'
release:
types: [ published ]

env:
IMAGE_NAME: 'samepaage/samepage-web'
DOCKERFILE: './frontend/Dockerfile'

jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

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

- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.IMAGE_NAME }}
tags: |
type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/') }}
type=ref,event=branch
type=sha,enable=true,priority=100,prefix=,suffix=,format=long
type=raw,value=${{ github.ref_name }},enable=${{ startsWith(github.ref, 'refs/tags/') }}
- name: set Node.js
uses: actions/setup-node@v4
with:
node-version: '16.14'
- name: build web
run: |
cd ./frontend
npm install -g pnpm
pnpm install --no-frozen-lockfile
pnpm nx run login:build
pnpm nx run web:build
pnpm nx run doc-chat:build
pnpm nx run h5:build
pnpm nx run playground:build
pnpm nx run scripts:build
cd ..

- name: Build and push
uses: docker/build-push-action@v5
with:
content: ./
file: ${{ env.DOCKERFILE }}
platforms: |
linux/amd64
linux/arm64
build-args: |
COMMIT_SHA=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
context: .
cache-from: type=gha
cache-to: type=gha,mode=max
130 changes: 128 additions & 2 deletions backend/ai-service/.gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,136 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

log/
# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

#.env
# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# Ignore Visual Studio Code settings
.vscode/

*.bak/
*.bak
23 changes: 23 additions & 0 deletions backend/management-service/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Compiled class files
*.class

# Log files
*.log

# IntelliJ IDEA files
.idea/

# Eclipse files
.classpath
.project
.settings/

# Maven files
target/

# Gradle files
build/

# Operating System files
.DS_Store
Thumbs.db
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,6 @@
*/
@Service("assistant_chat")
@Slf4j
@ConditionalOnBean(LlmGatewayService.class)
public class AssistantConvMsgTaskService implements ConvMsgTaskService {


Expand Down
2 changes: 1 addition & 1 deletion deploy/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ services:
one-api:
condition: service_healthy
ai-service-worker:
image: samepaage/ai-service:main
image: samepaage/samepage-ai-core:main
container_name: ai-service-worker
restart: always
networks:
Expand Down