Skip to content

Commit

Permalink
feat: support docker runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
zmh-program committed Feb 15, 2024
1 parent 5572a0e commit d0cad76
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 2 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Docker

on:
push:
branches: [ main ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

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

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/chatnio-blob-service:latest
15 changes: 15 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM python:3.9-slim-buster

WORKDIR /app

COPY requirements.txt .

RUN pip install --no-cache-dir -r requirements.txt

COPY . .

ENV PYTHONUNBUFFERED=1

EXPOSE 8000

CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,17 @@ Then the service will be running on `http://localhost:8000`
uvicorn main:app
```

## Using Docker
> Image: `programzmh/chatnio-blob-service`
```shell
docker run -p 8000:8000 programzmh/chatnio-blob-service

# with environment variables
# docker run -p 8000:8000 -e AZURE_SPEECH_KEY="..." -e AZURE_SPEECH_REGION="..." programzmh/chatnio-blob-service

```

## API
`POST` `/upload` Upload a file
```json
Expand All @@ -42,5 +53,5 @@ Response
```

Environment Variables
- `AZURE_SPEECH_KEY`: Azure Speech to Text Service Key
- `AZURE_SPEECH_REGION`: Azure Speech to Text Service Region
- `AZURE_SPEECH_KEY`: Azure Speech to Text Service Key (Required for Audio Support)
- `AZURE_SPEECH_REGION`: Azure Speech to Text Service Region (Required for Audio Support)

0 comments on commit d0cad76

Please sign in to comment.