55 tags :
66 - ' *'
77
8- # Environment variables for ECR repositories
9- env :
10- AWS_REGION : us-east-2
11- ECR_REPOSITORY : uiuc-chat-backend
12- ECR_REPOSITORY_WORKER : uiuc-chat-worker
13-
14- # Only build and push images, do not deploy
158jobs :
169 build-and-push :
17- name : Build and Push Backend Images (dev & prod)
10+ name : Build and Push Backend Image
1811 runs-on : ubuntu-latest
1912 steps :
2013 - name : Checkout code
21- uses : actions/checkout@v4
22-
23- - name : Configure AWS credentials (dev ECR)
24- uses : aws-actions/configure-aws-credentials@v4
25- with :
26- aws-access-key-id : ${{ secrets.AWS_ACCESS_KEY_ID }}
27- aws-secret-access-key : ${{ secrets.AWS_SECRET_ACCESS_KEY }}
28- aws-region : ${{ env.AWS_REGION }}
29-
30- - name : Login to Amazon ECR
31- id : login-ecr
32- uses : aws-actions/amazon-ecr-login@v2
33-
14+ uses : actions/checkout@v6
3415 - name : Set image tag (tag only)
3516 id : set-tag
3617 run : |
@@ -40,57 +21,16 @@ jobs:
4021 echo "git_tag=${GIT_TAG}" >> $GITHUB_OUTPUT
4122 echo "image_tag=${IMAGE_TAG}" >> $GITHUB_OUTPUT
4223
43- - name : Build, tag, and push backend image to Amazon ECR
44- id : build-image
45- env :
46- ECR_REGISTRY : ${{ steps.login-ecr.outputs.registry }}
47- run : |
48- set -euo pipefail
49- echo "Building backend image with tag: $IMAGE_TAG"
50- docker build -f Self-Hosted-Dockerfile -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
51- docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
52-
53- - name : Output image tag
54- run : |
55- echo "Backend image: ${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_REPOSITORY }}:${{ env.IMAGE_TAG }}"
56-
57- build-and-push-worker :
58- name : Build and Push Worker Images (dev & prod)
59- runs-on : ubuntu-latest
60- steps :
61- - name : Checkout code
62- uses : actions/checkout@v4
63-
64- - name : Configure AWS credentials (dev ECR)
65- uses : aws-actions/configure-aws-credentials@v4
24+ - name : Login to docker registry
25+ uses : docker/login-action@v4
6626 with :
67- aws-access-key-id : ${{ secrets.AWS_ACCESS_KEY_ID }}
68- aws-secret-access-key : ${{ secrets.AWS_SECRET_ACCESS_KEY }}
69- aws-region : ${{ env.AWS_REGION }}
70-
71- - name : Login to Amazon ECR
72- id : login-ecr-worker
73- uses : aws-actions/amazon-ecr-login@v2
74-
75- - name : Set worker image tag (tag only)
76- id : set-worker-tag
77- run : |
78- GIT_TAG=${GITHUB_REF#refs/tags/}
79- IMAGE_TAG="${GIT_TAG}"
80- echo "IMAGE_TAG=${IMAGE_TAG}" >> $GITHUB_ENV
81- echo "git_tag=${GIT_TAG}" >> $GITHUB_OUTPUT
82- echo "image_tag=${IMAGE_TAG}" >> $GITHUB_OUTPUT
83-
84- - name : Build, tag, and push worker image to Amazon ECR
85- id : build-worker-image
86- env :
87- ECR_REGISTRY : ${{ steps.login-ecr-worker.outputs.registry }}
88- run : |
89- set -euo pipefail
90- echo "Building worker image with tag: $IMAGE_TAG"
91- docker build -t $ECR_REGISTRY/$ECR_REPOSITORY_WORKER:$IMAGE_TAG ai_ta_backend/rabbitmq/
92- docker push $ECR_REGISTRY/$ECR_REPOSITORY_WORKER:$IMAGE_TAG
93-
94- - name : Output worker image tag
95- run : |
96- echo "Worker image: ${{ steps.login-ecr-worker.outputs.registry }}/${{ env.ECR_REPOSITORY_WORKER }}:${{ env.IMAGE_TAG }}"
27+ registry : docker-registry.osc.edu
28+ username : ${{ secrets.OSC_REGISTRY_ROBOT_OSC_USERNAME }}
29+ password : ${{ secrets.OSC_REGISTRY_ROBOT_OSC_TOKEN }}
30+ - name : Docker Build and Push
31+ uses : docker/build-push-action@v7
32+ with :
33+ context : .
34+ push : true
35+ tags : docker-registry.osc.edu/osc/hpcgpt_backend:${{ env.IMAGE_TAG }}
36+ file : Self-Hosted-Dockerfile
0 commit comments