Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

name: Continuous Deployment

on:
workflow_run:
workflows: ["Continuous Integration"]
types:
- completed

jobs:
build:

runs-on: self-hosted

steps:
- name: pull Docker image
run: sudo docker pull vijayj0shi/remx_api:latest
- name: Delete Old docker container
run: sudo docker rm -f remx_api-container || true
- name: Run Docker Container
run: sudo docker run -d -p 8080:8080 --name remx_api-container vijayj0shi/remx_api

16 changes: 11 additions & 5 deletions .github/workflows/python-app.yml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: Python application
name: Continuous Integration

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

permissions:
contents: read

jobs:
build:

Expand All @@ -34,4 +30,14 @@ jobs:
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Login Dockerhub
env:
DOCKER_USERNAME: ${{secrets.DOCKERHUB_USERNAME}}
DOCKER_PASSWORD: ${{secrets.DOCKERHUB_PASSWORD}}
run: docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD

- name: Build the Docker image
run: docker build -t vijayj0shi/remx_api:latest .
- name: push Docker image
run: docker push vijayj0shi/remx_api:latest

3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ coverage.xml
.hypothesis/
.pytest_cache/
cover/
testing.py

# Translations
*.mo
*.pot
Expand Down Expand Up @@ -141,6 +141,7 @@ myenv.bak/
# mkdocs documentation
/site

testing.py
# mypy
.mypy_cache/
.dmypy.json
Expand Down
10 changes: 4 additions & 6 deletions testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@

print(model)

# path = os.path.join("tests","tst.zip")
# files =[("files", open(path, "rb"))]
path = os.path.join("tests","tst.zip")
files =[("files", open(path, "rb"))]


# response = requests.post("http://127.0.0.1:8000/api/predict/upload", files=files)
response = requests.post("http://127.0.0.1:8000/api/predict/upload", files=files)

# # Check response

# print(response.json())
print(response.json())
Loading