-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from zsquare12/contrz
Contrz deployment pipeline set
- Loading branch information
Showing
4 changed files
with
86 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.venv | ||
.env | ||
test.ipynb | ||
text.py | ||
.git | ||
.gitignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
name: Build, Push Docker Image, Deploy, and Restart | ||
|
||
on: | ||
push: | ||
branches: | ||
- main # Triggers on changes to the main branch | ||
|
||
jobs: | ||
build-and-push: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
# Step 1: Checkout the repository | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
# Step 2: Set up Docker Buildx for building images | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
# Step 3: Log in to Docker Hub using credentials stored in GitHub secrets | ||
- name: Log in to Docker Hub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: jitenky | ||
password: ${{ secrets.DOKER_TOKEN }} | ||
|
||
# Step 4: Build and tag the Docker image | ||
- name: Build and tag Docker image | ||
run: | | ||
docker build -t jitenky/stapp3906:latest . | ||
# Step 5: Push the Docker image to Docker Hub | ||
- name: Push Docker image to Docker Hub | ||
run: | | ||
docker push jitenky/stapp3906:latest | ||
restart: | ||
permissions: | ||
id-token: write | ||
contents: none | ||
runs-on: ubuntu-latest | ||
needs: build-and-push | ||
steps: | ||
# Step 1: Log in to Azure CLI | ||
- name: Login to Azure CLI | ||
uses: azure/login@v2 | ||
with: | ||
creds: ${{ secrets.AZURE_CREDENTIALS }} # This should be a JSON object containing your credentials | ||
|
||
# Step 2: Restart the Azure Web App | ||
- name: Restart Azure Web App | ||
uses: azure/cli@v2 | ||
with: | ||
azcliversion: latest | ||
inlineScript: | | ||
az webapp restart --name st-sih-1134 --resource-group sih-ps |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Use an official Python runtime as a parent image | ||
FROM python:3.12-slim | ||
|
||
# Set the working directory in the container | ||
WORKDIR /app | ||
|
||
# Copy the requirements.txt file into the container at /app | ||
COPY requirements.txt . | ||
|
||
# Install any dependencies specified in requirements.txt | ||
RUN pip install --no-cache-dir -r requirements.txt | ||
|
||
# Copy the rest of the application code to /app | ||
COPY . . | ||
|
||
# Expose port 8000, as required by Azure App Service | ||
EXPOSE 8000 | ||
|
||
# Command to run the Streamlit app, configured to use port 8000 | ||
CMD ["streamlit", "run", "app.py", "--server.port=8000", "--server.address=0.0.0.0"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters