-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from oindrillac/main
added initial deployment files and dockerfile for deploying streamlit app on openshift
- Loading branch information
Showing
11 changed files
with
335 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: test-streamlit-image-build | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
paths: | ||
- app/**/* | ||
|
||
env: | ||
DOCKER_HUB_USERNAME: ochatterjee | ||
|
||
jobs: | ||
build: | ||
env: | ||
context: app | ||
image_name: api-docs-gen | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Check and verify version.json | ||
id: check_version | ||
run: | | ||
echo "IMAGE_TAGS=$(jq -r '.version' ${context}/version.json)" >> $GITHUB_ENV | ||
- name: Login to Docker Hub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ env.DOCKER_HUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Build image | ||
run: docker build --no-cache -t ${{ env.DOCKER_HUB_USERNAME }}/${{ env.image_name }}:${{ env.IMAGE_TAGS }} -f ${{ env.context }}/Dockerfile . | ||
|
||
- name: Push image | ||
run: docker push ${{ env.DOCKER_HUB_USERNAME }}/${{ env.image_name }}:${{ env.IMAGE_TAGS }} | ||
|
||
- name: Test image | ||
run: | | ||
echo "Running: docker run ${{ env.image_name }}:${{ env.IMAGE_TAGS}}" | ||
timeout --preserve-status 20s docker run -e GENAI_KEY='abc' -e GENAI_API='http://example.com' "${{ env.DOCKER_HUB_USERNAME }}/${{ env.image_name }}:${{ env.IMAGE_TAGS }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
venv | ||
**/secret.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
__pycache__ | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
FROM python:3.11 | ||
|
||
WORKDIR /app | ||
|
||
COPY ./app/requirements.txt . | ||
|
||
RUN pip install -r requirements.txt | ||
|
||
COPY ./app . | ||
|
||
COPY ./data ./data | ||
COPY ./data ./data | ||
|
||
CMD ["streamlit", "run", "app.py", "--browser.gatherUsageStats", "false", "--server.address", "0.0.0.0"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,12 @@ | ||
html2text | ||
ibm-generative-ai | ||
# new ibm version breaks existing code, | ||
# use this for the time being | ||
ibm-generative-ai>=2.0.0 | ||
python-dotenv | ||
streamlit-toggle-switch | ||
streamlit | ||
rouge-score | ||
py-readability-metrics | ||
openai | ||
textstat | ||
textstat | ||
scikit-learn |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: api-doc-deployment | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: api-doc | ||
template: | ||
metadata: | ||
labels: | ||
app: api-doc | ||
spec: | ||
imagePullSecrets: | ||
- name: dockerhub-secret | ||
containers: | ||
- name: api-doc-container | ||
image: docker.io/ochatterjee/api-docs-gen:v0.1.0 | ||
imagePullPolicy: Always | ||
env: | ||
- name: GENAI_KEY | ||
valueFrom: | ||
secretKeyRef: | ||
name: api-doc-secret | ||
key: GENAI_KEY | ||
- name: OPENAI_API_KEY | ||
valueFrom: | ||
secretKeyRef: | ||
name: api-doc-secret | ||
key: OPENAI_API_KEY | ||
ports: | ||
- containerPort: 8501 | ||
resources: | ||
limits: | ||
memory: "512Mi" | ||
cpu: "500m" | ||
requests: | ||
memory: "200Mi" | ||
cpu: "250m" |
Oops, something went wrong.