s
This commit is contained in:
86
.github/workflows/azure-webapps-python.yml
vendored
86
.github/workflows/azure-webapps-python.yml
vendored
@@ -1,86 +0,0 @@
|
|||||||
# This workflow will build and push a Python application to an Azure Web App when a commit is pushed to your default branch.
|
|
||||||
#
|
|
||||||
# This workflow assumes you have already created the target Azure App Service web app.
|
|
||||||
# For instructions see https://docs.microsoft.com/en-us/azure/app-service/quickstart-python?tabs=bash&pivots=python-framework-flask
|
|
||||||
#
|
|
||||||
# To configure this workflow:
|
|
||||||
#
|
|
||||||
# 1. Download the Publish Profile for your Azure Web App. You can download this file from the Overview page of your Web App in the Azure Portal.
|
|
||||||
# For more information: https://docs.microsoft.com/en-us/azure/app-service/deploy-github-actions?tabs=applevel#generate-deployment-credentials
|
|
||||||
#
|
|
||||||
# 2. Create a secret in your repository named AZURE_WEBAPP_PUBLISH_PROFILE, paste the publish profile contents as the value of the secret.
|
|
||||||
# For instructions on obtaining the publish profile see: https://docs.microsoft.com/azure/app-service/deploy-github-actions#configure-the-github-secret
|
|
||||||
#
|
|
||||||
# 3. Change the value for the AZURE_WEBAPP_NAME. Optionally, change the PYTHON_VERSION environment variables below.
|
|
||||||
#
|
|
||||||
# For more information on GitHub Actions for Azure: https://github.com/Azure/Actions
|
|
||||||
# For more information on the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
|
|
||||||
# For more samples to get started with GitHub Action workflows to deploy to Azure: https://github.com/Azure/actions-workflow-samples
|
|
||||||
|
|
||||||
name: Build and deploy Python app to Azure Web App
|
|
||||||
|
|
||||||
env:
|
|
||||||
AZURE_WEBAPP_NAME: ollama-docker # set this to the name of your Azure Web App
|
|
||||||
PYTHON_VERSION: '3.8' # set this to the Python version to use
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [ "main" ]
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: Set up Python version
|
|
||||||
uses: actions/setup-python@v3.0.0
|
|
||||||
with:
|
|
||||||
python-version: ${{ env.PYTHON_VERSION }}
|
|
||||||
cache: 'pip'
|
|
||||||
|
|
||||||
- name: Create and start virtual environment
|
|
||||||
run: |
|
|
||||||
python -m venv venv
|
|
||||||
source venv/bin/activate
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: pip install -r requirements.txt
|
|
||||||
|
|
||||||
# Optional: Add step to run tests here (PyTest, Django test suites, etc.)
|
|
||||||
|
|
||||||
- name: Upload artifact for deployment jobs
|
|
||||||
uses: actions/upload-artifact@v3
|
|
||||||
with:
|
|
||||||
name: python-app
|
|
||||||
path: |
|
|
||||||
.
|
|
||||||
!venv/
|
|
||||||
|
|
||||||
deploy:
|
|
||||||
permissions:
|
|
||||||
contents: none
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: build
|
|
||||||
environment:
|
|
||||||
name: 'Development'
|
|
||||||
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Download artifact from build job
|
|
||||||
uses: actions/download-artifact@v3
|
|
||||||
with:
|
|
||||||
name: python-app
|
|
||||||
path: .
|
|
||||||
|
|
||||||
- name: 'Deploy to Azure Web App'
|
|
||||||
id: deploy-to-webapp
|
|
||||||
uses: azure/webapps-deploy@v2
|
|
||||||
with:
|
|
||||||
app-name: ${{ env.AZURE_WEBAPP_NAME }}
|
|
||||||
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}
|
|
||||||
35
.github/workflows/deploy.yml
vendored
Normal file
35
.github/workflows/deploy.yml
vendored
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
name: test-and-deploy
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
workflow_run:
|
||||||
|
workflows: ["ollama-docker"] # This triggers the deployment after ollama-docker workflow completes
|
||||||
|
types:
|
||||||
|
- completed
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
id-token: write
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
deploy-azure:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: 'Az CLI login'
|
||||||
|
uses: azure/login@v1
|
||||||
|
with:
|
||||||
|
client-id: ${{ secrets.AZURE_CLIENT_ID }}
|
||||||
|
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
|
||||||
|
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
|
||||||
|
|
||||||
|
- name: 'Run Azure CLI commands'
|
||||||
|
run: |
|
||||||
|
az containerapp up \
|
||||||
|
--name my-container-app \
|
||||||
|
--resource-group my-container-apps \
|
||||||
|
--location centralus \
|
||||||
|
--environment 'my-container-apps' \
|
||||||
|
--image ${{ secrets.DOCKER_HUB_USERNAME }}/ollama-docker:latest \ # Ensure this matches your Docker Hub repo
|
||||||
|
--target-port 80 \
|
||||||
|
--ingress external \
|
||||||
|
--query properties.configuration.ingress.fqdn
|
||||||
67
.github/workflows/main_ollama-docker.yml
vendored
67
.github/workflows/main_ollama-docker.yml
vendored
@@ -1,67 +0,0 @@
|
|||||||
# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
|
|
||||||
# More GitHub Actions for Azure: https://github.com/Azure/actions
|
|
||||||
# More info on Python, GitHub Actions, and Azure App Service: https://aka.ms/python-webapps-actions
|
|
||||||
|
|
||||||
name: Build and deploy Python app to Azure Web App - ollama-docker
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Set up Python version
|
|
||||||
uses: actions/setup-python@v1
|
|
||||||
with:
|
|
||||||
python-version: '3.8'
|
|
||||||
|
|
||||||
- name: Create and start virtual environment
|
|
||||||
run: |
|
|
||||||
python -m venv venv
|
|
||||||
source venv/bin/activate
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: pip install -r requirements.txt
|
|
||||||
|
|
||||||
# Optional: Add step to run tests here (PyTest, Django test suites, etc.)
|
|
||||||
- name: Zip artifact for deployment
|
|
||||||
run: zip release.zip ./* -r
|
|
||||||
|
|
||||||
- name: Upload artifact for deployment jobs
|
|
||||||
uses: actions/upload-artifact@v3
|
|
||||||
with:
|
|
||||||
name: python-app
|
|
||||||
path: |
|
|
||||||
release.zip
|
|
||||||
!venv/
|
|
||||||
|
|
||||||
deploy:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: build
|
|
||||||
environment:
|
|
||||||
name: 'Production'
|
|
||||||
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Download artifact from build job
|
|
||||||
uses: actions/download-artifact@v3
|
|
||||||
with:
|
|
||||||
name: python-app
|
|
||||||
|
|
||||||
- name: Unzip artifact for deployment
|
|
||||||
run: unzip release.zip
|
|
||||||
|
|
||||||
- name: 'Deploy to Azure Web App'
|
|
||||||
uses: azure/webapps-deploy@v2
|
|
||||||
id: deploy-to-webapp
|
|
||||||
with:
|
|
||||||
app-name: 'ollama-docker'
|
|
||||||
slot-name: 'Production'
|
|
||||||
publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_3CABAB9C43C6414B8F45297710A243A4 }}
|
|
||||||
2
.github/workflows/ollama-docker.yaml
vendored
2
.github/workflows/ollama-docker.yaml
vendored
@@ -16,6 +16,8 @@ on:
|
|||||||
schedule:
|
schedule:
|
||||||
- cron: '0 0 * * 0'
|
- cron: '0 0 * * 0'
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
workflow_call: # Added to allow this workflow to be called by other workflows
|
||||||
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-push-images:
|
build-and-push-images:
|
||||||
|
|||||||
4
setup.sh
4
setup.sh
@@ -1,6 +1,6 @@
|
|||||||
# run using docker
|
# run using docker
|
||||||
docker build -t ollama-docker-image .
|
docker build -t valiantlynx/ollama-docker .
|
||||||
docker run --name ollama-docker-container -d -p 11434:11434 -p 8000:8000 -v $(pwd):/code ollama-docker-image
|
docker run --name ollama-docker-container -d -p 8000:8000 -v $(pwd):/code valiantlynx/ollama-docker:latest
|
||||||
|
|
||||||
#connect to turborepo
|
#connect to turborepo
|
||||||
git subtree add --prefix=apps/ollama-docker https://github.com/valiantlynx/ollama-docker.git main --squash
|
git subtree add --prefix=apps/ollama-docker https://github.com/valiantlynx/ollama-docker.git main --squash
|
||||||
|
|||||||
Reference in New Issue
Block a user