Skip to content

Commit

Permalink
initial commit for interview simulator
Browse files Browse the repository at this point in the history
  • Loading branch information
theuerc committed Apr 2, 2023
0 parents commit b1649ed
Show file tree
Hide file tree
Showing 74 changed files with 4,679 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[run]
source = interview_simulator
omit =
tests/*
autoapp.py

10 changes: 10 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Environment variable overrides for local development
FLASK_APP=autoapp.py
FLASK_DEBUG=1
FLASK_ENV=development
DATABASE_URL=sqlite:////tmp/dev.db
GUNICORN_WORKERS=1
LOG_LEVEL=debug
SECRET_KEY=not-so-secret
# In production, set to a higher number, like 31556926
SEND_FILE_MAX_AGE_DEFAULT=0
24 changes: 24 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
module.exports = {
"extends": "airbnb-base",
"parser": "@babel/eslint-parser",
"parserOptions": {
"requireConfigFile": false,
},
"rules": {
"no-param-reassign": 0,
"import/no-extraneous-dependencies": 0,
"import/prefer-default-export": 0,
"consistent-return": 0,
"no-confusing-arrow": 0,
"no-underscore-dangle": 0
},
"env": {
"browser": true,
"node": true
},
"globals": {
"__dirname": true,
"jQuery": true,
"$": true
}
}
26 changes: 26 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "daily"

- package-ecosystem: "docker"
directory: "/"
schedule:
interval: "daily"

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"

- package-ecosystem: "pip"
directory: "/requirements"
schedule:
interval: "daily"

- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "daily"
31 changes: 31 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Build Status

on:
- push

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- uses: actions/setup-node@v3.5.1
with:
node-version: "18.x"
registry-url: "https://registry.npmjs.org"
- name: Install Python dependencies
run: |
pip install pipenv
pipenv install --dev
- name: Install Node dependencies
run: npm install
- run: cp .env.example .env
- name: Run Node lints
run: npm run lint
- name: Run Python lints
run: pipenv run flask lint --check
- name: Run Python tests
run: pipenv run flask test
64 changes: 64 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
*.py[cod]

# C extensions
*.so

# Packages
*.egg
*.egg-info
build
eggs
parts
bin
var
sdist
develop-eggs
.installed.cfg
lib
lib64

# Installer logs
pip-log.txt

# Unit test / coverage reports
.coverage
.tox
nosetests.xml

# Translations
*.mo

# Mr Developer
.mr.developer.cfg
.project
.pydevproject

# Complexity
output/*.html
output/*/index.html

# Sphinx
docs/_build

.webassets-cache

# Virtualenvs
env/

# npm
/node_modules/

# webpack-built files
/interview_simulator/static/build/

# Configuration
.env

# Development database
*.db

# API Keys
silken-waters-*.json

# Audio Files
*.mp3
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"python.formatting.provider": "black"
}
58 changes: 58 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# ================================== BUILDER ===================================
ARG INSTALL_PYTHON_VERSION=${INSTALL_PYTHON_VERSION:-PYTHON_VERSION_NOT_SET}
ARG INSTALL_NODE_VERSION=${INSTALL_NODE_VERSION:-NODE_VERSION_NOT_SET}

FROM node:${INSTALL_NODE_VERSION}-buster-slim AS node
FROM python:${INSTALL_PYTHON_VERSION}-slim-buster AS builder

WORKDIR /app

COPY --from=node /usr/local/bin/ /usr/local/bin/
COPY --from=node /usr/lib/ /usr/lib/
# See https://github.com/moby/moby/issues/37965
RUN true
COPY --from=node /usr/local/lib/node_modules /usr/local/lib/node_modules
COPY ["Pipfile", "shell_scripts/auto_pipenv.sh", "./"]
RUN pip install --no-cache pipenv
RUN pipenv install

COPY package.json ./
RUN npm install

COPY webpack.config.js autoapp.py ./
COPY interview_simulator interview_simulator
COPY assets assets
COPY .env.example .env
RUN npm run-script build

# ================================= PRODUCTION =================================
FROM python:${INSTALL_PYTHON_VERSION}-slim-buster as production

WORKDIR /app

RUN useradd -m sid
RUN chown -R sid:sid /app
USER sid
ENV PATH="/home/sid/.local/bin:${PATH}"

COPY --from=builder --chown=sid:sid /app/interview_simulator/static /app/interview_simulator/static
COPY ["Pipfile", "shell_scripts/auto_pipenv.sh", "./"]
RUN pip install --no-cache pipenv
RUN pipenv install

COPY supervisord.conf /etc/supervisor/supervisord.conf
COPY supervisord_programs /etc/supervisor/conf.d

COPY . .

EXPOSE 5000
ENTRYPOINT ["/bin/bash", "shell_scripts/supervisord_entrypoint.sh"]
CMD ["-c", "/etc/supervisor/supervisord.conf"]


# ================================= DEVELOPMENT ================================
FROM builder AS development
RUN pipenv install --dev
EXPOSE 2992
EXPOSE 5000
CMD [ "pipenv", "run", "npm", "start" ]
19 changes: 19 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright 2023 Coulton Theuer

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
60 changes: 60 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
[[source]]
url = "https://pypi.python.org/simple"
verify_ssl = true
name = "pypi"

[packages]
# Flask
click = ">=7.0"
Flask = "==2.2.2"
Werkzeug = "==2.2.2"
# Database
Flask-SQLAlchemy = "==3.0.2"
psycopg2-binary = "==2.9.5"
SQLAlchemy = "==1.4.45"
# Migrations
Flask-Migrate = "==4.0.0"
# Forms
email-validator = "==1.3.0"
Flask-WTF = "==1.0.1"
WTForms = "==3.0.1"
# Deployment
gevent = "==22.10.2"
gunicorn = ">=19.9.0"
supervisor = "==4.2.4"
# Flask Static Digest
Flask-Static-Digest = "==0.2.1"
# Auth
Flask-Bcrypt = "==1.0.1"
Flask-Login = "==0.6.2"
# Caching
Flask-Caching = ">=1.7.2"
# Debug toolbar
Flask-DebugToolbar = "==0.13.1"
# Environment variable parsing
environs = "==9.5.0"
openai = "*"
gcloud = "*"
google-cloud-texttospeech = "*"
black = "*"
mpg123 = "*"

[dev-packages]
# Testing
factory-boy = "==3.2.1"
pdbpp = "==0.10.3"
pytest = "==7.2.0"
pytest-cov = "==4.0.0"
WebTest = "==3.0.0"
# Lint and code style
black = "==22.12.0"
flake8 = "==6.0.0"
flake8-blind-except = "==0.2.1"
flake8-debugger = "==4.1.2"
flake8-docstrings = "==1.6.0"
flake8-isort = "==6.0.0"
isort = "==5.11.4"
pep8-naming = "==0.13.3"

[requires]
python_version = "3.11"
Loading

0 comments on commit b1649ed

Please sign in to comment.