Skip to content

Commit

Permalink
Update docker image for async refactor, use new ACR (#625)
Browse files Browse the repository at this point in the history
Co-authored-by: Ian Seabock (Centific Technologies Inc) <[email protected]>
  • Loading branch information
sarah-widder and Ian Seabock (Centific Technologies Inc) committed Feb 17, 2024
1 parent 8c4ab56 commit 31dbce2
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 21 deletions.
24 changes: 10 additions & 14 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
name: Docker Image CI

on:
workflow_dispatch:
inputs:
branch:
description: 'The branch to build'
required: true
push:
branches:
- main

jobs:

Expand All @@ -18,19 +16,17 @@ jobs:
uses: Azure/docker-login@v1
with:
# Container registry username
username: ${{ secrets.ACR_USERNAME }}
username: ${{ secrets.SAMPLEAPP_ACR_USERNAME }}
# Container registry password
password: ${{ secrets.ACR_PASSWORD }}
password: ${{ secrets.SAMPLEAPP_ACR_PASSWORD }}
# Container registry server url
login-server: ${{ secrets.ACR_LOGIN_SERVER }}
login-server: sampleappaoaichatgpt.azurecr.io

- uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.branch }}
- name: Build the Docker image
run:
docker build . --file WebApp.Dockerfile --tag fruoccopublic.azurecr.io/sample-app-aoai-chatgpt:$(date +'%Y-%m-%d')_$GITHUB_RUN_NUMBER;
docker tag fruoccopublic.azurecr.io/sample-app-aoai-chatgpt:$(date +'%Y-%m-%d')_$GITHUB_RUN_NUMBER fruoccopublic.azurecr.io/sample-app-aoai-chatgpt:latest;
docker push fruoccopublic.azurecr.io/sample-app-aoai-chatgpt:$(date +'%Y-%m-%d')_$GITHUB_RUN_NUMBER;
docker push fruoccopublic.azurecr.io/sample-app-aoai-chatgpt:latest;
docker build . --file WebApp.Dockerfile --tag sampleappaoaichatgpt.azurecr.io/sample-app-aoai-chatgpt:$(date +'%Y-%m-%d')_$GITHUB_RUN_NUMBER;
docker tag sampleappaoaichatgpt.azurecr.io/sample-app-aoai-chatgpt:$(date +'%Y-%m-%d')_$GITHUB_RUN_NUMBER sampleappaoaichatgpt.azurecr.io/sample-app-aoai-chatgpt:latest;
docker push sampleappaoaichatgpt.azurecr.io/sample-app-aoai-chatgpt:$(date +'%Y-%m-%d')_$GITHUB_RUN_NUMBER;
docker push sampleappaoaichatgpt.azurecr.io/sample-app-aoai-chatgpt:latest;

7 changes: 3 additions & 4 deletions WebApp.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ RUN apk add --no-cache --virtual .build-deps \
openssl-dev \
curl \
&& apk add --no-cache \
libpq \
&& pip install --no-cache-dir uwsgi
libpq

COPY requirements.txt /usr/src/app/
RUN pip install --no-cache-dir -r /usr/src/app/requirements.txt \
Expand All @@ -27,6 +26,6 @@ RUN pip install --no-cache-dir -r /usr/src/app/requirements.txt \
COPY . /usr/src/app/
COPY --from=frontend /home/node/app/static /usr/src/app/static/
WORKDIR /usr/src/app

EXPOSE 80
CMD ["python", "-m", "gunicorn", "app:app"]

CMD ["gunicorn" , "-b", "0.0.0.0:80", "app:app"]
4 changes: 2 additions & 2 deletions infrastructure/deployment.json
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@
},
"AzureOpenAIApiVersion": {
"type": "string",
"defaultValue": "2023-06-01-preview",
"defaultValue": "2023-12-01-preview",
"metadata": {
"description": "Azure OpenAI Api Version"
}
Expand Down Expand Up @@ -358,7 +358,7 @@
}
},
"variables": {
"WebAppImageName": "DOCKER|fruoccopublic.azurecr.io/sample-app-aoai-chatgpt:latest",
"WebAppImageName": "DOCKER|sampleappaoaichatgpt.azurecr.io/sample-app-aoai-chatgpt:latest",
"cosmosdb_account_name": "[format('db-{0}', parameters('WebsiteName'))]",
"cosmosdb_database_name": "db_conversation_history",
"cosmosdb_container_name": "conversations",
Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ python-dotenv==1.0.0
azure-cosmos==4.5.0
quart==0.19.4
uvicorn==0.24.0
aiohttp==3.9.2
aiohttp==3.9.2
gunicorn==20.1.0

5 comments on commit 31dbce2

@ramseyjacob
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sarah-widder - I attempted to deploy this in my Azure subscription today and this new container registry is giving me an unauthorized error. Does it need to be made open for public pulls?

image

@ramseyjacob
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sarah-widder - I attempted to deploy this in my Azure subscription today and this new container registry is giving me an unauthorized error. Does it need to be made open for public pulls?

image

The pull is working now - if you did something, thanks!

@sarah-widder
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ramseyjacob yes, I configured it for anonymous pull access :) thanks so much for raising the issue, I didn’t realize I had missed that in the configuration.

@ramseyjacob
Copy link

@ramseyjacob ramseyjacob commented on 31dbce2 Feb 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ramseyjacob yes, I configured it for anonymous pull access :) thanks so much for raising the issue, I didn’t realize I had missed that in the configuration.

Thanks so much!

Is there a way I can view the list of tags for this image? I would rather not configure my App Service to 'latest' because it gave me a surprise last time when the Contoso branding was pushed - wasn't ready for that :) My company is using this app and I'd like to control it by pinning it to a certain version tag instead of latest, but when I try to use the Docker API to view any metadata, it is unauthorized. Is that something you'd be able to open for anonymous access as well?

@ramseyjacob
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ramseyjacob yes, I configured it for anonymous pull access :) thanks so much for raising the issue, I didn’t realize I had missed that in the configuration.

Thanks so much!

Is there a way I can view the list of tags for this image? I would rather not configure my App Service to 'latest' because it gave me a surprise last time when the Contoso branding was pushed - wasn't ready for that :) My company is using this app and I'd like to control it by pinning it to a certain version tag instead of latest, but when I try to use the Docker API to view any metadata, it is unauthorized. Is that something you'd be able to open for anonymous access as well?

I was able to piece together the tag for the version I wanted based on the GitHub Action job log using the date it ran and the $GITHUB_RUN_NUMBER. Thanks again for all your work on this app!

Please sign in to comment.