Skip to content

Commit

Permalink
Updated workflow and app.py file
Browse files Browse the repository at this point in the history
  • Loading branch information
abhijitpaul0212 committed Nov 6, 2023
1 parent 0c56467 commit e79bffc
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 1 deletion.
36 changes: 36 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Build and push image to ECR
on:
push:
branches:
- master



jobs:
build-and-push-ecr-image:
name: Build Image
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Install Utilities
run: |
sudo apt-get update
sudo apt-get install -y jq unzip
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Build, tag, and push image to Amazon ECR
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: GemstonePricePrediction
IMAGE_TAG: latest
run: |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM python:3.9-slim-buster
WORKDIR /service
COPY requirements.txt .
COPY . ./
RUN pip install -r requirements.txt
ENTRYPOINT ["python3", "app.py"]
2 changes: 1 addition & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ def predict_datapoint():


if __name__ == "__main__":
app.run(port=5001, debug=True)
app.run(host="0.0.0.0", port=8080)
2 changes: 2 additions & 0 deletions template.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

list_of_files = [
".github/workflows/.gitkeep",
".github/workflows/main.yaml",
"Dockerfile",
f"src/{package_name}/__init__.py",
f"src/{package_name}/components/__init__.py",
f"src/{package_name}/components/data_ingestion.py",
Expand Down

0 comments on commit e79bffc

Please sign in to comment.