Spaces:
Sleeping
Sleeping
bsiddhharth commited on
Commit ·
fab6224
1
Parent(s): ad38423
changed readme so that it works only with aws for now
Browse files- .dockerignore +18 -0
- .github/workflows/main.yml +66 -66
- Dockerfile +9 -0
.dockerignore
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Ignore virtual environment
|
| 2 |
+
venv/
|
| 3 |
+
|
| 4 |
+
# Ignore environment files
|
| 5 |
+
.env
|
| 6 |
+
|
| 7 |
+
# Ignore Python compiled files
|
| 8 |
+
*.pyc
|
| 9 |
+
__pycache__/
|
| 10 |
+
|
| 11 |
+
# Ignore specific files
|
| 12 |
+
extraction_pydantic.py
|
| 13 |
+
cv_quest(with main).py
|
| 14 |
+
logger.py
|
| 15 |
+
cv_job_reco2.py
|
| 16 |
+
|
| 17 |
+
# Ignore log files
|
| 18 |
+
app.log
|
.github/workflows/main.yml
CHANGED
|
@@ -1,81 +1,81 @@
|
|
| 1 |
-
name: Sync to Hugging Face hub
|
| 2 |
-
on:
|
| 3 |
-
|
| 4 |
-
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
| 8 |
|
| 9 |
-
jobs:
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
-
|
| 25 |
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
|
| 30 |
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
|
|
|
| 1 |
+
# name: Sync to Hugging Face hub
|
| 2 |
+
# on:
|
| 3 |
+
# push:
|
| 4 |
+
# branches: [main]
|
| 5 |
|
| 6 |
+
# # to run this workflow manually from the Actions tab
|
| 7 |
+
# workflow_dispatch:
|
| 8 |
|
| 9 |
+
# jobs:
|
| 10 |
+
# sync-to-hub:
|
| 11 |
+
# runs-on: ubuntu-latest
|
| 12 |
+
# steps:
|
| 13 |
+
# - uses: actions/checkout@v3
|
| 14 |
+
# with:
|
| 15 |
+
# fetch-depth: 0
|
| 16 |
+
# lfs: true
|
| 17 |
+
# - name: Push to hub
|
| 18 |
+
# env:
|
| 19 |
+
# HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
| 20 |
+
# run: git push --force https://SID2702:$HF_TOKEN@huggingface.co/spaces/SID2702/CV_Process main
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
+
name: Deploy Application Docker Image to EC2 instance
|
| 25 |
|
| 26 |
+
on:
|
| 27 |
+
push:
|
| 28 |
+
branches: [main]
|
| 29 |
|
| 30 |
|
| 31 |
+
jobs:
|
| 32 |
+
Continuous-Integration:
|
| 33 |
+
runs-on: ubuntu-latest
|
| 34 |
|
| 35 |
+
steps:
|
| 36 |
+
- name: Checkout
|
| 37 |
+
uses: actions/checkout@v2
|
| 38 |
|
| 39 |
+
- name: Configure AWS credentials
|
| 40 |
+
uses: aws-actions/configure-aws-credentials@v1
|
| 41 |
+
with:
|
| 42 |
+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
| 43 |
+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
| 44 |
+
aws-region: ${{ secrets.AWS_DEFAULT_REGION }}
|
| 45 |
|
| 46 |
+
- name: Login to Amazon ECR
|
| 47 |
+
id: login-ecr
|
| 48 |
+
uses: aws-actions/amazon-ecr-login@v1
|
| 49 |
|
| 50 |
+
- name: Build, tag, and push image to Amazon ECR
|
| 51 |
+
id: build-image
|
| 52 |
+
env:
|
| 53 |
+
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
|
| 54 |
+
ECR_REPOSITORY: ${{ secrets.ECR_REPO }}
|
| 55 |
+
IMAGE_TAG: latest
|
| 56 |
+
run: |
|
| 57 |
+
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
|
| 58 |
+
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
|
| 59 |
+
echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG"
|
| 60 |
+
|
| 61 |
+
Continuous-Deployment:
|
| 62 |
+
needs: Continuous-Integration
|
| 63 |
+
runs-on: self-hosted
|
| 64 |
+
steps:
|
| 65 |
+
- name: Checkout
|
| 66 |
+
uses: actions/checkout@v3
|
| 67 |
|
| 68 |
+
- name: Configure AWS credentials
|
| 69 |
+
uses: aws-actions/configure-aws-credentials@v1
|
| 70 |
+
with:
|
| 71 |
+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
| 72 |
+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
| 73 |
+
aws-region: ${{ secrets.AWS_DEFAULT_REGION }}
|
| 74 |
|
| 75 |
+
- name: Login to Amazon ECR
|
| 76 |
+
id: login-ecr
|
| 77 |
+
uses: aws-actions/amazon-ecr-login@v1
|
| 78 |
|
| 79 |
+
- name: Run Docker Image to serve users
|
| 80 |
+
run: |
|
| 81 |
+
docker run -d -e AWS_ACCESS_KEY_ID="${{ secrets.AWS_ACCESS_KEY_ID }}" -e AWS_SECRET_ACCESS_KEY="${{ secrets.AWS_SECRET_ACCESS_KEY }}" -e AWS_DEFAULT_REGION="${{ secrets.AWS_DEFAULT_REGION }}" -e PINECONE_API_KEY="${{ secrets.PINECONE_API_KEY }}" -e OPENAI_API_KEY="${{ secrets.OPENAI_API_KEY }}" -p 8080:8080 "${{ steps.login-ecr.outputs.registry }}"/"${{ secrets.ECR_REPO }}":latest
|
Dockerfile
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.10-slim-buster
|
| 2 |
+
|
| 3 |
+
WORKDIR /app
|
| 4 |
+
|
| 5 |
+
COPY . /app
|
| 6 |
+
|
| 7 |
+
RUN pip install -r requirements.txt
|
| 8 |
+
|
| 9 |
+
CMD ["python3", "app.py"]
|