Skip to content

Commit

Permalink
switch to poetry
Browse files Browse the repository at this point in the history
  • Loading branch information
jmargutt committed Aug 15, 2024
1 parent 8ffabd6 commit 023eb85
Show file tree
Hide file tree
Showing 5 changed files with 109 additions and 35 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/build-deploy-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
# More GitHub Actions for Azure: https://github.com/Azure/actions

name: build and deploy to dev

on:
push:
branches:
- dev
workflow_dispatch:

jobs:
build:
runs-on: 'ubuntu-latest'
defaults:
run:
working-directory: ./app

steps:
- uses: actions/checkout@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Log in to registry
uses: docker/login-action@v1
with:
registry: https://510emergencies.azurecr.io/
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}

- name: Build and push container image to container registry
uses: docker/build-push-action@v2
with:
push: true
tags: 510emergencies.azurecr.io/kobo-connect-dev:${{ github.sha }}
file: Dockerfile

deploy:
runs-on: ubuntu-latest
needs: build
environment:
name: 'production'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}

steps:
- name: Deploy container image to Azure Web App
id: deploy-to-webapp
uses: azure/webapps-deploy@v2
with:
app-name: 'kobo-connect'
slot-name: 'production'
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE_DEV }}
images: '510emergencies.azurecr.io/kobo-connect-dev:${{ github.sha }}'
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
# More GitHub Actions for Azure: https://github.com/Azure/actions

name: build and deploy to Azure Web App
name: build and deploy to prod

on:
push:
Expand All @@ -14,7 +14,7 @@ jobs:
runs-on: 'ubuntu-latest'
defaults:
run:
working-directory: ./summarizer-api
working-directory: ./app

steps:
- uses: actions/checkout@v2
Expand Down
9 changes: 6 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
# python base image in the container from Docker Hub
FROM python:3.9-slim
FROM python:3.11-slim

# copy files to the /app folder in the container
ADD clients /app/clients
ADD mappings /app/mappings
COPY ./main.py /app/main.py
COPY ./requirements.txt /app/requirements.txt
COPY ./pyproject.toml /app/pyproject.toml
COPY ./poetry.lock /app/poetry.lock

# set the working directory in the container to be /app
WORKDIR /app

# install required packages
RUN pip install -r requirements.txt
RUN pip install poetry
RUN poetry config virtualenvs.create false
RUN poetry install --no-root

# expose the port that uvicorn will run the app on
ENV PORT=8000
Expand Down
47 changes: 47 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
[tool.poetry]
name = "kobo-connect"
version = "0.0.2"
authors = [
"Jacopo Margutti <[email protected]>"
]
description = "kobo-connect"
readme = "README.md"
repository = "https://github.com/rodekruis/kobo-connect"
packages = [{include = "clients"}]

[tool.poetry.dependencies]
python = "^3.11"
aiohttp = "*"
aiosignal = "*"
async-timeout = "*"
azure-monitor-opentelemetry-exporter = "*"
azure-core = "*"
azure-storage-blob = "*"
azure-cosmos = "*"
attrs = "*"
certifi = "*"
charset-normalizer = "*"
click = "*"
colorama = "*"
fastapi = "*"
frozenlist = "*"
idna = "*"
lxml = "*"
multidict = "*"
pandas = "*"
passlib = "*"
pypdf = "*"
python-docx = "*"
python-dotenv = "*"
python-jose = "*"
regex = "*"
requests = "*"
tiktoken = "*"
tqdm = "*"
urllib3 = "*"
yarl = "*"
uvicorn = "*"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
30 changes: 0 additions & 30 deletions requirements.txt

This file was deleted.

0 comments on commit 023eb85

Please sign in to comment.