Skip to content

Commit

Permalink
CD Deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
Mannerow committed Oct 13, 2024
1 parent 008b1e7 commit 60cddfb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 17 deletions.
26 changes: 12 additions & 14 deletions .github/workflows/cd-deploy-workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,60 +15,58 @@ jobs:
- name: Checkout Repo
uses: actions/checkout@v3

# Step 2: Set up Python 3.9 and create a virtual environment
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: '3.9'

# Step 3: Configure AWS Credentials
# Step 2: Configure AWS Credentials
- 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: ${{ secrets.AWS_REGION }}

# Step 4: Create the kaggle.json file in the working directory
# Step 3: Create the kaggle.json file in the working directory
- name: Create kaggle.json
run: |
echo '${{ secrets.KAGGLE_JSON }}' > kaggle.json
# Step 5: Create a .env file for Docker Compose using the secrets
# Step 4: Create a .env file for Docker Compose using the secrets
- name: Create .env file for Docker Compose
run: |
echo "MLFLOW_BACKEND_STORE_URI=${{ secrets.MLFLOW_BACKEND_STORE_URI }}" >> .env
echo "MLFLOW_DEFAULT_ARTIFACT_ROOT=${{ secrets.MLFLOW_DEFAULT_ARTIFACT_ROOT }}" >> .env
echo "MLFLOW_TRACKING_URI=${{ secrets.MLFLOW_TRACKING_URI }}" >> .env
echo "PREFECT_API_KEY=${{ secrets.PREFECT_API_KEY }}" >> .env
echo "PREFECT_WORKSPACE=${{ secrets.PREFECT_WORKSPACE }}" >> .env
echo "AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID }}" >> .env
echo "AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }}" >> .env
echo "AWS_ACCOUNT_ID=${{ secrets.AWS_ACCOUNT_ID }}" >> .env
echo "AWS_DEFAULT_REGION=${{ secrets.AWS_DEFAULT_REGION }}" >> .env
echo "AWS_REGION=${{ secrets.AWS_REGION }}" >> .env
echo "TF_VAR_ecr_repository_name=${{ secrets.TF_VAR_ecr_repository_name }}" >> .env
echo "TF_VAR_aws_region=${{ secrets.TF_VAR_aws_region }}" >> .env
echo "TF_VAR_mlflow_models_bucket=${{ secrets.TF_VAR_mlflow_models_bucket }}" >> .env
echo "TF_VAR_prediction_bucket=${{ secrets.TF_VAR_prediction_bucket }}" >> .env
# Step 6: Build the Docker Image
# Step 5: Build the Docker Image
- name: Build Docker Image
run: |
docker build -f Dockerfile -t ${{ secrets.TF_VAR_ecr_repository_name }}:latest .
# Step 7: Log in to Amazon ECR
# Step 6: Log in to Amazon ECR
- name: Log in to Amazon ECR
run: |
aws ecr get-login-password --region ${{ secrets.AWS_REGION }} | docker login --username AWS --password-stdin ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.${{ secrets.AWS_REGION }}.amazonaws.com
# Step 8: Tag the Docker Image
# Step 7: Tag the Docker Image
- name: Tag Docker Image
run: |
docker tag ${{ secrets.TF_VAR_ecr_repository_name }}:latest ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.${{ secrets.AWS_REGION }}.amazonaws.com/${{ secrets.TF_VAR_ecr_repository_name }}:latest
# Step 9: Push the Docker Image to ECR
# Step 8: Push the Docker Image to ECR
- name: Push Docker Image to ECR
run: |
docker push ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.${{ secrets.AWS_REGION }}.amazonaws.com/${{ secrets.TF_VAR_ecr_repository_name }}:latest
# Step 10: Run Docker Compose to bring up services
# Step 9: Run Docker Compose to bring up services
- name: Run Docker Compose
run: |
docker compose up -d
Expand Down
6 changes: 3 additions & 3 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '3.8'
version: '3.9'

services:
mlflow:
Expand Down Expand Up @@ -67,7 +67,7 @@ services:
- "8081:8080" # Changed to avoid port conflict with app service
networks:
- back-tier
- front-tier
- front-tier

grafana:
image: grafana/grafana
Expand All @@ -89,6 +89,6 @@ services:
networks:
front-tier:
back-tier:

volumes:
grafana_data: {}

0 comments on commit 60cddfb

Please sign in to comment.