add Dockerfile

This commit is contained in:
aynic.os 2023-01-08 16:37:51 +00:00
parent cb1ca1ec32
commit 0a78158c17
8 changed files with 78 additions and 4 deletions

8
Makefile Normal file
View File

@ -0,0 +1,8 @@
MYOS ?= ../myos
MYOS_REPOSITORY ?= $(patsubst %/$(APP),%/myos,$(APP_REPOSITORY))
APP ?= $(lastword $(subst /, ,$(APP_REPOSITORY)))
APP_REPOSITORY ?= $(shell git config --get remote.origin.url 2>/dev/null)
-include $(MYOS)/make/include.mk
$(MYOS):
-@git clone $(MYOS_REPOSITORY) $(MYOS)

View File

@ -2,5 +2,11 @@
Bogui est une app Flutter clone Libre et open source du playground de OpenAI, capable d'utiliser le model text-davinci-003, mais aussi le model gpt2 en local, sans frais donc.
Qu'ils aillent tous se faire enculer.
Qu'ils aillent tous se faire enculer. Et gratos pour le coup.
## Install
```
make && make build SECRET_KEY=sk-...
make up logs
```

3
docker/bogui.mk Normal file
View File

@ -0,0 +1,3 @@
ENV_VARS += BOGUI_SERVICE_80_TAGS
BOGUI_SERVICE_NAME ?= bogui
BOGUI_SERVICE_80_TAGS ?= $(call urlprefix)

24
docker/bogui/Dockerfile Normal file
View File

@ -0,0 +1,24 @@
# link: https://github.com/PlugFox/docker_flutter/blob/master/dockerfiles/flutter_web.dockerfile
ARG FLUTTER_VERSION=stable
FROM plugfox/flutter:${FLUTTER_VERSION} as build
# Setup flutter tools for web developement
RUN set -eux; flutter config --no-analytics --enable-web \
&& flutter precache --universal --web
# Add lables
LABEL name="librezo/bogui:${FLUTTER_VERSION}-web" \
description="Free GPT" \
flutter.channel="${FLUTTER_VERSION}" \
flutter.version="${FLUTTER_VERSION}"
COPY . /app
WORKDIR /app
ARG OPENAI_SECRET_KEY
RUN flutter build web --dart-define=OPENAPI_SECRET_KEY=${OPENAI_SECRET_KEY}
RUN flutter doctor
FROM nginx:alpine as master
COPY --from=build /app/build/web /usr/share/nginx/html

View File

@ -0,0 +1,19 @@
version: '3.6'
services:
bogui:
build:
args:
- DOCKER_REPOSITORY=${DOCKER_REPOSITORY}
image: ${DOCKER_REPOSITORY}/bogui:${DOCKER_IMAGE_TAG}
labels:
- SERVICE_80_CHECK_HTTP=/
- SERVICE_80_NAME=${COMPOSE_SERVICE_NAME}-bogui-80
- SERVICE_80_TAGS=${BOGUI_SERVICE_80_TAGS:-}
networks:
- public
networks:
public:
external: true
name: ${DOCKER_NETWORK_PUBLIC}

14
docker/docker-compose.yml Normal file
View File

@ -0,0 +1,14 @@
version: '3.6'
services:
bogui:
build:
args:
- OPENAI_SECRET_KEY=${BOGUI_OPENAI_SECRET_KEY:-${OPENAI_SECRET_KEY:-${SECRET_KEY}}}
- DOCKER_BUILD_DIR=docker/bogui
- FLUTTER_VERSION=${BOGUI_FLUTTER_VERSION:-stable}
context: ../
dockerfile: docker/bogui/Dockerfile
ports:
- 80/tcp
restart: always

View File

@ -3,7 +3,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:openai_gpt3_api/openai_gpt3_api.dart';
class OpenAI extends GPT3 {
OpenAI() : super('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');
OpenAI() : super(String.fromEnvironment('OPENAPI_SECRET_KEY'));
// final prompt = TextEditingController();
final prompt =
StateProvider<TextEditingController>((ref) => TextEditingController());
@ -46,4 +46,4 @@ double truncateDouble(double val, int decimals) {
valString = valString.substring(0, dotIndex + decimals + 1);
return double.parse(valString);
}
}

View File

@ -5,7 +5,7 @@
"display": "standalone",
"background_color": "#0175C2",
"theme_color": "#0175C2",
"description": "A new Flutter project.",
"description": "free GPT",
"orientation": "portrait-primary",
"prefer_related_applications": false,
"icons": [