Skip to content

Commit

Permalink
Merge pull request #10 from untitledaiproject/ethan/web
Browse files Browse the repository at this point in the history
Ethan/web
  • Loading branch information
etown authored Feb 7, 2024
2 parents adf50c2 + c4f42bd commit 9210983
Show file tree
Hide file tree
Showing 34 changed files with 4,078 additions and 21 deletions.
131 changes: 131 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-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/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/
cover/

# 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

# poetry
poetry.lock
.pyproject.toml
__pypackages__/

# MyPy
.mypy_cache/

# Pytest
.pytest_cache/

# VS Code
.vscode/

# PyCharm
.idea/

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

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# Others
.DS_Store
*.swp
*.bak
*.tmp
*~

# Exclude the Dockerfile and .dockerignore to prevent potential leaks
Dockerfile
.dockerignore
7 changes: 1 addition & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ RUN apt-get update && apt-get install -y \
ffmpeg \
pkg-config \
libcairo2-dev \
libgirepository1.0-dev \
portaudio19-dev \
python3-gst-1.0 \
cmake && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
Expand All @@ -30,9 +28,6 @@ RUN poetry config virtualenvs.create false && \

RUN poetry run python -c "print('Poetry and project dependencies are installed correctly.')"

ARG CONFIG_FILE
ENV CONFIG_FILE=${CONFIG_FILE}

RUN echo '#!/bin/sh\n\
if [ -z "$CONFIG_FILE" ]; then\n\
poetry run untitledai serve --host 0.0.0.0\n\
Expand All @@ -41,4 +36,4 @@ else\n\
fi' > /entrypoint.sh && \
chmod +x /entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]
ENTRYPOINT ["/entrypoint.sh"]
120 changes: 120 additions & 0 deletions clients/web/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
# Next.js build output
.next/
out/
build/

# Node modules
node_modules/

# Logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids/
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov/

# Coverage directory used by tools like istanbul
coverage/
*.lcov

# nyc test coverage
.nyc_output/

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt/

# Bower dependency directory (https://bower.io/)
bower_components/

# IDEs and editors
.idea/
*.swp
*.swo
.vscode/
*.sublime-workspace
*.sublime-project
*.atom/
*.iml
*.eml
*.esproj
*.tmp
*.tmp_proj
*.tmproj
*.tmproject
*.tproject
nbproject/
*.komodoproject
.kate-swp/
*.swp
*.swo
*.swn
*.sml
.session
*.log

# OS generated files
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db

# Testing
__tests__/
__mocks__/

# Production
.env.local
.env.development.local
.env.test.local
.env.production.local

# Misc
*.gz
*.zip
*.rar
*.tar
*.tar.gz
*.tgz
*.bzip
*.bzip2
*.7z
*.iso
*.dmg
*.img
*.msi
*.msp
*.sms
*.exe
*.dll
*.deb
*.rpm
*.qcow2
*.vdi
*.vmdk
*.vhd
*.vhdx
*.bak
*.sql
*.psd
*.ai
*.sketch
*.md
README.md
LICENSE
.dockerignore
Dockerfile
*.pem
*.key
*.env
*.cert
36 changes: 36 additions & 0 deletions clients/web/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js
.yarn/install-state.gz

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
33 changes: 33 additions & 0 deletions clients/web/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
FROM node:18-alpine AS builder

WORKDIR /app

COPY package.json package-lock.json ./

RUN npm install

COPY . .

RUN npm run build

FROM node:18-alpine AS runner

WORKDIR /app

COPY --from=builder /app/next.config.mjs ./
COPY --from=builder /app/public ./public
COPY --from=builder /app/.next ./.next
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/package.json ./package.json
COPY --from=builder /app/server.js ./server.js

EXPOSE 3000

ENV NODE_ENV production

# If no url is set we assume that it's local
ENV UNTITLEDAI_API_URL=http://host.docker.internal:8000

# Start the app with the custom server if it's local for proxying, otherwise start the normal server
CMD ["/bin/sh", "-c", "if [ \"$UNTITLEDAI_API_URL\" = 'http://host.docker.internal:8000' ]; then npm run startCustom; else npm start; fi"]

43 changes: 43 additions & 0 deletions clients/web/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@

## Getting Started

First, set the client token environmental variable:

```bash
export UNTITLEDAI_USER_CLIENT_TOKEN=your-client-token
```

Optionally, set the google maps token if you want maps to work:

```bash
export GOOGLE_MAPS_API_KEY=your-google-maps-token
```

Then, install the dependencies:

```bash
yarn install
# or
npm install
# or
pnpm install
# or
bun install
```


Then, run the development server:

```bash
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
```

Open [http://localhost:3000](http://localhost:3000)

IMPORTANT: Currently the webapp just passes the token for authentication there is no way to log in so do not expose this to the internet!
Loading

0 comments on commit 9210983

Please sign in to comment.