-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
35c10b6
commit 8bf9785
Showing
18 changed files
with
268 additions
and
763 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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
FROM --platform=$BUILDPLATFORM node:18.9-alpine3.15 AS client-builder | ||
|
||
WORKDIR /ui | ||
COPY frontend/package.json /ui/package.json | ||
COPY frontend/package-lock.json /ui/package-lock.json | ||
RUN npm install | ||
|
||
COPY frontend /ui | ||
RUN npm run build | ||
|
||
FROM alpine | ||
|
||
ENV PYTHONUNBUFFERED=1 | ||
RUN apk --update --upgrade add python3 python3-dev gcc musl-dev jpeg-dev zlib-dev libffi-dev cairo-dev pango-dev gdk-pixbuf-dev docker-cli | ||
RUN ln -sf python3 /usr/bin/python | ||
RUN python3 -m ensurepip | ||
RUN pip3 install --no-cache --upgrade pip setuptools | ||
|
||
LABEL org.opencontainers.image.title="P8Hub - Private AI Hub" \ | ||
org.opencontainers.image.description="Host and use your own AI Services. Keep everything simple and private." \ | ||
org.opencontainers.image.vendor="Viet-Anh NGUYEN" \ | ||
com.docker.desktop.extension.api.version=">= 0.2.0" \ | ||
com.docker.desktop.extension.icon="https://raw.githubusercontent.com/vietanhdev/vietanhdev/main/p8hub/p8hub.png" \ | ||
com.docker.extension.screenshots='[{"alt":"P8Hub Screenshot", "url":"https://raw.githubusercontent.com/vietanhdev/vietanhdev/main/p8hub/screenshot.png"}]' \ | ||
com.docker.extension.detailed-description="<h1>Description</h1><p>Host and use your own AI Services. Keep everything simple and private.</p>" \ | ||
com.docker.extension.publisher-url="https://www.docker.com" \ | ||
com.docker.extension.additional-urls='[{"title":"SDK Documentation","url":"https://docs.docker.com/desktop/extensions-sdk"}]' \ | ||
com.docker.extension.changelog="<ul><li>Added metadata to provide more information about the extension.</li></ul>" | ||
|
||
COPY docker-compose.yaml docker-compose.yaml | ||
COPY metadata.json metadata.json | ||
COPY images/p8hub.svg p8hub.svg | ||
COPY extension-ui ui | ||
|
||
COPY p8hub /workspace/p8hub | ||
COPY setup.py /workspace | ||
COPY README.md /workspace | ||
COPY pyproject.toml /workspace | ||
COPY MANIFEST.in /workspace | ||
COPY --from=client-builder /ui/out /workspace/p8hub/frontend-dist | ||
RUN cd /workspace && pip3 install -e . | ||
|
||
CMD python3 -m p8hub.app |
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,32 @@ | ||
EXTENSION:= | ||
ifeq ($(OS),Windows_NT) | ||
EXTENSION:=.exe | ||
endif | ||
|
||
IMAGE?=vietanhdev/p8hub-extension | ||
TAG?=latest | ||
BUILDER=buildx-multi-arch | ||
|
||
INFO_COLOR = \033[0;36m | ||
NO_COLOR = \033[m | ||
|
||
build-extension: ## Build service image to be deployed as a desktop extension | ||
docker build --tag=$(IMAGE):$(TAG) . | ||
|
||
install-extension: build-extension ## Install the extension | ||
docker extension install $(IMAGE):$(TAG) | ||
|
||
update-extension: build-extension ## Update the extension | ||
docker extension update $(IMAGE):$(TAG) | ||
|
||
prepare-buildx: ## Create buildx builder for multi-arch build, if not exists | ||
docker buildx inspect $(BUILDER) || docker buildx create --name=$(BUILDER) --driver=docker-container --driver-opt=network=host | ||
|
||
push-extension: prepare-buildx ## Build & Upload extension image to hub. Do not push if tag already exists: make push-extension tag=0.1 | ||
docker pull $(IMAGE):$(TAG) && echo "Failure: Tag already exists" || docker buildx build --push --builder=$(BUILDER) --platform=linux/amd64,linux/arm64 --build-arg TAG=$(TAG) --tag=$(IMAGE):$(TAG) . | ||
|
||
help: ## Show this help | ||
@echo Please specify a build target. The choices are: | ||
@grep -E '^[0-9a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "$(INFO_COLOR)%-30s$(NO_COLOR) %s\n", $$1, $$2}' | ||
|
||
.PHONY: build-extension push-extension help |
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,10 @@ | ||
services: | ||
devenv-volumes: | ||
image: ${DESKTOP_PLUGIN_IMAGE} | ||
cap_add: | ||
- DAC_OVERRIDE | ||
- FOWNER | ||
volumes: | ||
- /var/lib/docker:/var/lib/docker | ||
ports: | ||
- "18180:5678" |
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,18 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>P8Hub Extension</title> | ||
<style> | ||
* { | ||
margin: 0; | ||
padding: 0; | ||
box-sizing: border-box; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<iframe src="http://localhost:18180" frameborder="0" style="width: 100%; height: 100vh;"></iframe> | ||
</body> | ||
</html> |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,15 @@ | ||
{ | ||
"icon": "p8hub.svg", | ||
"vm": { | ||
"composefile": "docker-compose.yaml", | ||
"exposes": { "socket": "extension-volumes.sock" } | ||
}, | ||
"ui": { | ||
"dashboard-tab": { | ||
"title": "P8Hub", | ||
"root": "/ui", | ||
"src": "index.html", | ||
"backend": { "socket": "extension-volumes.sock" } | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -1,9 +1,5 @@ | ||
import os | ||
import pathlib | ||
|
||
DATA_ROOT = os.path.abspath( | ||
os.path.join(os.path.expanduser("~"), "p8hub-data") | ||
) | ||
pathlib.Path(DATA_ROOT).mkdir(parents=True, exist_ok=True) | ||
|
||
DATABASE_PATH = os.path.abspath(os.path.join(DATA_ROOT, "p8hub.db")) | ||
|
Oops, something went wrong.