-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from VaquitApp/develop
Merge develop
- Loading branch information
Showing
19 changed files
with
1,768 additions
and
179 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
.github | ||
.gitignore | ||
.stignore | ||
.vscode | ||
venv | ||
**/__pycache__ | ||
.pytest_cache | ||
.mypy_cache | ||
|
||
k8s | ||
README.md | ||
okteto.yml | ||
.stignore | ||
pytest.ini | ||
|
||
*.db | ||
Makefile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -175,4 +175,4 @@ pyrightconfig.json | |
|
||
# End of https://www.toptal.com/developers/gitignore/api/python | ||
|
||
sql_app.db | ||
*.db |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,40 @@ | ||
# Usa la imagen oficial de Python como base | ||
FROM python:3.10 | ||
# https://fastapi.tiangolo.com/deployment/docker/ | ||
FROM python:3.11-alpine as requirements-stage | ||
|
||
# Variables de entorno | ||
ENV PYTHONDONTWRITEBYTECODE 1 | ||
ENV PYTHONUNBUFFERED 1 | ||
WORKDIR /tmp | ||
|
||
# Directorio de trabajo | ||
WORKDIR /app | ||
# Instala poetry | ||
RUN pip install poetry | ||
# Copia solo el listado de dependencias | ||
COPY ./pyproject.toml ./poetry.lock* /tmp/ | ||
|
||
# Copia los archivos de la aplicación | ||
COPY . . | ||
# Compila el requirements.txt | ||
RUN poetry export -f requirements.txt --output requirements.txt --without-hashes | ||
|
||
# Instala las dependencias | ||
RUN pip install --no-cache-dir -r requirements.txt | ||
|
||
FROM python:3.11 as production-stage | ||
|
||
WORKDIR /app | ||
|
||
# Variables de entorno | ||
ENV PYTHONDONTWRITEBYTECODE 1 | ||
ENV PYTHONUNBUFFERED 1 | ||
|
||
# Instala las herramientas de PostgreSQL | ||
RUN apt-get update \ | ||
&& apt-get install -y --no-install-recommends postgresql-client \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Instala las dependencias | ||
COPY --from=requirements-stage /tmp/requirements.txt /app/requirements.txt | ||
RUN pip install --no-cache-dir --upgrade -r /app/requirements.txt | ||
|
||
# Copia los archivos de la aplicación | ||
COPY . . | ||
|
||
# Puerto expuesto | ||
EXPOSE 8000 | ||
|
||
# Comando para ejecutar la aplicación | ||
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"] | ||
CMD ["uvicorn", "src.main:app", "--host", "0.0.0.0", "--port", "8000"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2023 Vaquitapp | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
all: format lint test | ||
|
||
install: | ||
poetry install | ||
|
||
format: | ||
poetry run black src | ||
|
||
lint: | ||
poetry run flake8 src | ||
|
||
test: | ||
rm test.db 2> /dev/null || true | ||
poetry run pytest -sv . | ||
|
||
run: install | ||
poetry run uvicorn src.main:app --host localhost --port 8000 --reload |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Vaquitapp backend | ||
|
||
[![CI](https://github.com/VaquitApp/backend/actions/workflows/python-app.yml/badge.svg)](https://github.com/VaquitApp/backend/actions/workflows/python-app.yml) | ||
|
||
## Dependencies | ||
|
||
- make | ||
- python3.11 | ||
- poetry | ||
|
||
## Installation | ||
|
||
After installing dependencies, run: | ||
|
||
```bash | ||
make install | ||
``` | ||
|
||
## How to run | ||
|
||
Run app locally with: | ||
|
||
```bash | ||
make run | ||
``` | ||
|
||
***Note**: this will also install dependencies with poetry* | ||
|
||
## Development pipeline | ||
|
||
This project uses the *pytest* test suite in the CI pipeline. | ||
To run tests locally, use the command `make test`. | ||
|
||
To format or lint the project, run `make format` or `make lint` respectively. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
# docker-compose.yml | ||
|
||
version: '3' | ||
version: "3" | ||
|
||
services: | ||
app: | ||
build: . | ||
ports: | ||
- "8000:8000" | ||
- "8000:8000" |
Oops, something went wrong.