-
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 #58 from TukiLaCosa/dockerize-app
Testing automatico y Dockerizacion de la app
- Loading branch information
Showing
5 changed files
with
100 additions
and
0 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,11 @@ | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__ | ||
*.pyc | ||
*.pyo | ||
*.pyd | ||
|
||
# Tests directory | ||
./app/tests/ | ||
|
||
# Database file | ||
./app/database/*.sqlite |
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,38 @@ | ||
name: Tuki Testing CI | ||
on: [push] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
|
||
env: | ||
ENVIRONMENT: test | ||
TEST_DIRECTORY: ${{ github.workspace }}/app/tests | ||
TEST_DB_FILE: ${{ github.workspace }}/app/database/database_test.sqlite | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Install and caching poetry dependencies | ||
run: pipx install poetry | ||
|
||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.10" | ||
cache: "poetry" | ||
- run: poetry install | ||
|
||
- name: Test Game module | ||
run: | | ||
poetry run coverage run -m pytest $TEST_DIRECTORY/game_tests | ||
rm -f $TEST_DB_FILE | ||
- name: Test Player module | ||
run: | | ||
poetry run coverage run -m pytest $TEST_DIRECTORY/player_tests | ||
rm -f $TEST_DB_FILE | ||
- name: Test Card module | ||
run: | | ||
poetry run coverage run -m pytest $TEST_DIRECTORY/card_tests | ||
rm -f $TEST_DB_FILE |
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,23 @@ | ||
FROM python:3.10-slim as requirements-stage | ||
|
||
WORKDIR /tmp | ||
|
||
RUN pip install poetry | ||
|
||
COPY ./pyproject.toml ./poetry.lock* ./ | ||
|
||
RUN poetry export -f requirements.txt --output requirements.txt --without-hashes | ||
|
||
FROM python:3.10-slim | ||
|
||
WORKDIR /code | ||
|
||
COPY --from=requirements-stage /tmp/requirements.txt ./requirements.txt | ||
|
||
RUN pip install --no-cache-dir --upgrade -r ./requirements.txt | ||
|
||
COPY ./app ./app | ||
|
||
EXPOSE 8000 | ||
|
||
CMD ["uvicorn", "app.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
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,16 @@ | ||
version: '3.8' | ||
|
||
services: | ||
api: | ||
build: | ||
dockerfile: Dockerfile | ||
context: . | ||
volumes: | ||
- database:/code/app/database/ | ||
env_file: | ||
- .env | ||
ports: | ||
- 8000:8000 | ||
|
||
volumes: | ||
database: |