Skip to content

Commit

Permalink
Template basics
Browse files Browse the repository at this point in the history
  • Loading branch information
exrhizo committed Aug 28, 2024
1 parent 85e150b commit d91a15c
Show file tree
Hide file tree
Showing 24 changed files with 2,990 additions and 1 deletion.
37 changes: 37 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: CI

on: push

jobs:
backend:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.9'

- name: Build and test backend
run: |
echo "TODO"
ls
frontend:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '14'

- name: Install frontend dependencies
run: |
echo "TODO"
cd frontend
ls
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
data
.DS_Store
.mypy_cache

*.pyc
32 changes: 31 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,32 @@
# louie-infra-template
# Mini Louie.AI

A starting point for dockerized python web

## Development

### Prerequisites
- Docker
- Docker Compose
- Node.js


### Initialize data set

- `./init-data.sh`

### Frontend

- `cd frontend`
- `npm i`
- `npm run dev`

### Run Server on host

- `uvicorn server.main:app --reload`

### Docker

- `./dc build`
- `./dc up`

To update docker python libraries, add them to environment.yml. Note `./dc` is a convience alias for `docker compose`.
16 changes: 16 additions & 0 deletions dc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

# Compatibility with Apple Silicon
if [[ $(uname -m) == 'arm64' ]]; then
export PLATFORM="linux/aarch64"
fi

if docker compose version &> /dev/null; then
DC="docker compose"
$DC version
else
DC="docker-compose"
$DC --version
fi

$DC $@
10 changes: 10 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
services:
app:
build:
context: .
dockerfile: python.Dockerfile
ports:
- "8888:8888"
volumes:
- ./server:/app/server
- ./data:/app/data
9 changes: 9 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

# echo "Current shell: $SHELL"
# conda info

echo "Encoding 'Hello, world!'"
python -c "import tiktoken; enc = tiktoken.get_encoding('gpt2'); print(enc.encode('Hello, world!'))"
echo ""
echo "This is an example to show python environment is working"
12 changes: 12 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: louie
channels:
- conda-forge
dependencies:
- python=3.10.13
- pip=23.3.1
- fastapi=0.100.0
- uvicorn=0.23.1

# Example for when dependencies are not available in conda-forge
- pip:
- tiktoken==0.7.0
24 changes: 24 additions & 0 deletions frontend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
28 changes: 28 additions & 0 deletions frontend/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import js from '@eslint/js'
import globals from 'globals'
import reactHooks from 'eslint-plugin-react-hooks'
import reactRefresh from 'eslint-plugin-react-refresh'
import tseslint from 'typescript-eslint'

export default tseslint.config(
{ ignores: ['dist'] },
{
extends: [js.configs.recommended, ...tseslint.configs.recommended],
files: ['**/*.{ts,tsx}'],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
},
plugins: {
'react-hooks': reactHooks,
'react-refresh': reactRefresh,
},
rules: {
...reactHooks.configs.recommended.rules,
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
},
},
)
12 changes: 12 additions & 0 deletions frontend/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Mini Louie.AI</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
Loading

0 comments on commit d91a15c

Please sign in to comment.