diff --git a/.github/workflows/api-cd.yml b/.github/workflows/api-cd.yml new file mode 100644 index 0000000..34c2cc3 --- /dev/null +++ b/.github/workflows/api-cd.yml @@ -0,0 +1,29 @@ +name: API-CD + +on: + push: + branches: + - 'main' + +env: + WORKING_DIR: ./api + +jobs: + build-and-push: + runs-on: ubuntu-latest + defaults: + run: + shell: bash + working-directory: ${{ env.WORKING_DIR }} + steps: + - name: Checkout code + uses: actions/checkout@v2 + + # - name: Login to Docker Hub + # run: echo "${{ secrets.DOCKERHUB_PUSH_TOKEN }}" | docker login -u muzammil360 --password-stdin + + - name: Login, Build and push Docker image + run: | + echo "${{ secrets.DOCKERHUB_PUSH_TOKEN }}" | docker login -u muzammil360 --password-stdin + docker build -t muzammil360/ml-kubernetes:latest . + docker push muzammil360/ml-kubernetes:latest diff --git a/.github/workflows/api-ci.yml b/.github/workflows/api-ci.yml index 9899afc..202dabe 100644 --- a/.github/workflows/api-ci.yml +++ b/.github/workflows/api-ci.yml @@ -1,4 +1,4 @@ -name: Python application +name: API-CI on: pull_request: @@ -11,7 +11,6 @@ env: jobs: build: - runs-on: ubuntu-latest defaults: run: diff --git a/api/Dockerfile b/api/Dockerfile new file mode 100644 index 0000000..2589b41 --- /dev/null +++ b/api/Dockerfile @@ -0,0 +1,12 @@ +FROM python:3.8-slim + +WORKDIR /app +RUN pip install --upgrade pip + +COPY requirements.txt /app/ +RUN pip install --no-cache-dir -r requirements.txt + +COPY . /app +RUN python download_weights.py + +CMD ["uvicorn","server:app"]