Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
IgorDuino committed May 8, 2024
0 parents commit dfa0451
Show file tree
Hide file tree
Showing 79 changed files with 7,162 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
DATABASE_URL=postgresql+asyncpg://app:app@app_db:5432/app
REDIS_URL=redis://:myStrongPassword@redis:6379

SITE_DOMAIN=127.0.0.1
SECURE_COOKIES=false

ENVIRONMENT=LOCAL

CORS_HEADERS=["*"]
CORS_ORIGINS=["http://localhost:3000"]

# optional config
REDIS_MAX_CONNECTIONS=128
36 changes: 36 additions & 0 deletions .github/workflows/linters.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Run linter checks

on:
pull_request:
branches:
- '**'

jobs:
run_linters_tests:
name: Run linters and tests
runs-on: ubuntu-latest
container: python:3.10.7
services:
postgres:
image: postgres:14.1
env:
POSTGRES_PASSWORD: app
POSTGRES_USER: app
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install dependencies
run: |
pip install -r requirements/dev.txt
continue-on-error: true
- name: Lint with ruff
run: |
ruff src
- name: Format with ruff
run: |
ruff format src --diff
140 changes: 140 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
# 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
MANIFEST

# 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
*.py,cover
.hypothesis/
.pytest_cache/

# 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

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

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

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/
postgres-data*
node_modules/
.DS_Store

# PyCharm
.idea/
backup.dump
backup.dump.gz
.vscode
.python_history
32 changes: 32 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
FROM python:3.11-slim-buster

RUN apt-get update && \
apt-get install -y gcc libpq-dev && \
apt clean && \
rm -rf /var/cache/apt/*

ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PYTHONIOENCODING=utf-8

# Install & setup Poetry
RUN pip install -U pip && \
pip install --no-cache-dir poetry && \
poetry config virtualenvs.create false

# Copy only requirements to cache them in docker layer
WORKDIR /src
COPY pyproject.toml poetry.lock /src/

# Project initialization:
RUN poetry install --no-interaction --no-ansi --no-dev --no-root

# Copying the rest of the project
COPY . /src

RUN useradd -m -d /src -s /bin/bash app \
&& chown -R app:app /src/* && chmod +x /src/scripts/*

USER app

ENTRYPOINT ["./scripts/start-dev.sh"]
33 changes: 33 additions & 0 deletions Dockerfile.prod
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
FROM python:3.11-slim-buster

RUN apt-get update && \
apt-get install -y gcc libpq-dev && \
apt clean && \
rm -rf /var/cache/apt/*

ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PYTHONIOENCODING=utf-8

# Install & setup Poetry
RUN pip install -U pip && \
pip install --no-cache-dir poetry && \
poetry config virtualenvs.create false

# Copy only requirements to cache them in docker layer
WORKDIR /src
COPY pyproject.toml poetry.lock /src/

# Project initialization:
RUN poetry install --no-interaction --no-ansi --no-dev --no-root

# Copying the rest of the project
COPY . /src

RUN useradd -m -d /src -s /bin/bash app \
&& chown -R app:app /src/* && chmod +x /src/scripts/*


USER app

CMD ["./scripts/start-prod.sh"]
Loading

0 comments on commit dfa0451

Please sign in to comment.