Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #15: Add Azure build and push to ACR workflow #17

Merged
merged 10 commits into from
Dec 14, 2023
File renamed without changes.
22 changes: 22 additions & 0 deletions .github/workflows/azure-deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Azure Docker Deployment

on:
push:
workflow_dispatch:
pull_request:

jobs:
build:
uses: ai-cfia/github-workflows/.github/workflows/workflow-build-push-container-azure.yml@main
with:
container-name: ${{ github.event.repository.name }}
tag: ${{ github.sha }}
secrets: inherit

deploy:
needs: build
uses: ai-cfia/github-workflows/.github/workflows/workflow-deploy-azure.yml@55-azure-workflow-deployment-missing
with:
container-name: ${{ github.event.repository.name }}
tag: ${{ github.sha }}
secrets: inherit
9 changes: 5 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Dockerfile
# Base image with Python 3.11 on Alpine
FROM python:3.11-alpine
# We chose Python 3.11 full variant as other variants lacks some tools necessary
# to build this project's dependencies
FROM python:3.11

rngadam marked this conversation as resolved.
Show resolved Hide resolved
# Establish /code as working directory in the container
WORKDIR /code
Expand All @@ -10,7 +10,8 @@ COPY ./requirements-production.txt requirements.txt
RUN pip3 install --no-cache-dir -r requirements.txt

# Copy source code into the working directory
COPY ./src .
COPY ./app ./app
COPY finesse-weights.json .

# Use Gunicorn as the server, configuring it for the Flask app
ENTRYPOINT gunicorn --bind :$PORT --workers 1 --threads 8 --timeout 0 --forwarded-allow-ips "*" app:app
6 changes: 4 additions & 2 deletions docs/DEPLOYMENT.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Deployment

## Azure
Create and set the environment variables based on `.env.template`. Make sure `FINESSE_BACKEND_DEBUG_MODE` is not set to `True`.
Create and set the environment variables based on `.env.template`. Make sure
`FINESSE_BACKEND_DEBUG_MODE` is NOT set to `True` in PRODUCTION builds.

Build (do this from your WSL Ubuntu where Docker is already installed):

Expand All @@ -12,5 +13,6 @@ docker build -t finesse-backend .
test locally:

```
docker run -p 5000:5000 -e PORT=5000 finesse-backend
export PORT=<your_port_here>
docker run -p $PORT:$PORT -e PORT=$PORT --env-file .env finesse-backend
```
6 changes: 4 additions & 2 deletions docs/USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ Running:
flask run -h 0.0.0.0 --debug
```

Alternatively, set the `FINESSE_BACKEND_DEBUG_MODE` environment variable to `True` and
Alternatively, set the `FINESSE_BACKEND_DEBUG_MODE` environment variable to
`True` and
run:
```
python run.py
Expand All @@ -16,7 +17,8 @@ python run.py
Query from the command-line:

```
curl -X POST http://localhost:5000/search --data '{"query": "is e.coli a virus or bacteria?"}' -H "Content-Type: application/json"
curl -X POST http://localhost:5000/search --data '{"query": "is e.coli a virus
or bacteria?"}' -H "Content-Type: application/json"
```

JSON structure explanation:
Expand Down
Loading