Skip to content

Commit 292aeb0

Browse files
authored
Merge pull request #1 from idjohnson/llmupdates
updates
2 parents 3ce3baf + 8d11949 commit 292aeb0

3 files changed

Lines changed: 41 additions & 15 deletions

File tree

.github/workflows/container-build.yml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
cd charts
2727
helm package pybsposter
2828
- id: tagandpush
29-
name: Tag and Push
29+
name: Tag and Push (Harbor)
3030
run: |
3131
export BUILDIMGTAG="`cat Dockerfile | tail -n1 | sed 's/^.*\///g'`"
3232
export FINALBUILDTAG="`cat Dockerfile | tail -n1 | sed 's/^#//g'`"
@@ -45,6 +45,27 @@ jobs:
4545
CR_PAT: ${{ secrets.CR_PAT }}
4646
CR_USER: ${{ secrets.CR_USER }}
4747
if: github.ref == 'refs/heads/main'
48+
- id: tagandpushdh
49+
name: Tag and Push (Dockerhub)
50+
run: |
51+
export BUILDIMGTAG="`cat Dockerfile | tail -n1 | sed 's/^.*\///g'`"
52+
# Note the replacement to Dockerhub
53+
export FINALBUILDTAG="`cat Dockerfile | tail -n1 | sed 's/^#.*\//idjohnson\//g'`"
54+
export FINALBUILDLATEST="`cat Dockerfile | tail -n1 | sed 's/^#//g' | sed 's/:.*/:latest/'`"
55+
docker tag $BUILDIMGTAG $FINALBUILDTAG
56+
docker tag $BUILDIMGTAG $FINALBUILDLATEST
57+
docker images
58+
echo $CR_PAT | docker login -u $CR_USER --password-stdin
59+
docker push "$FINALBUILDTAG"
60+
# add a "latest" for others to use
61+
docker push $FINALBUILDLATEST
62+
# Push Charts
63+
export CVER="`cat ./charts/pybsposter/Chart.yaml | grep 'version:' | sed 's/version: //' | tr -d '\n'`"
64+
#helm push ./charts/pybsposter-$CVER.tgz oci://harbor.freshbrewed.science/library/
65+
env: # Or as an environment variable
66+
CR_PAT: ${{ secrets.DH_PAT }}
67+
CR_USER: ${{ secrets.DH_USER }}
68+
if: github.ref == 'refs/heads/main'
4869
- id: tagnpushdry
4970
name: Tag and Push (DRY RUN)
5071
run: |

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ ENV NAME=World
1919
# Run app.py when the container launches
2020
CMD ["python", "app.py"]
2121

22-
#harbor.freshbrewed.science/library/pybsposter:0.0.4
22+
#harbor.freshbrewed.science/library/pybsposter:0.0.5

app.py

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,28 @@ def handle_post():
1717
if total_length > 300:
1818
text = text[:(300 - len(link) - 4)] + "... " # Trim and add ellipsis
1919

20-
client = Client()
20+
try:
21+
client = Client()
22+
except Exception as e:
23+
print(f"Failed to connect to server: {e}")
24+
2125
profile = client.login(username, password)
2226

2327
builder = client_utils.TextBuilder().text(text).link(link,link)
2428
text_string = str(builder) # Convert TextBuilder to a string
25-
post = client.send_post(builder)
26-
# Don't really need to like my own posts
27-
# client.like(post.uri, post.cid)
28-
29-
response = {
30-
31-
"YOU ARE:": profile.display_name,
32-
"TEXT": text_string,
33-
"LINK": link
34-
}
35-
36-
return jsonify(response)
29+
30+
try:
31+
post = client.send_post(builder)
32+
response = {
33+
"YOU ARE:": profile.display_name,
34+
"TEXT": text_string,
35+
"LINK": link
36+
}
37+
38+
return jsonify(response)
39+
except Exception as e:
40+
print(f"Failed to post: {e}")
41+
return {'error': 'Failed to send post'}, 500
3742

3843
if __name__ == '__main__':
3944
app.run(host='0.0.0.0', port=5000)

0 commit comments

Comments
 (0)