Skip to content

Commit 4ccf9da

Browse files
Copilotdarthkalijenslehnhoff
authored
Add push image functionality to GitLab Migration Build Pipeline Workflow (#20)
* Initial plan * Add push container functionality to GitLab migration workflow Co-authored-by: darthkali <46423967+darthkali@users.noreply.github.com> * Fix version logic and improve workflow robustness Co-authored-by: darthkali <46423967+darthkali@users.noreply.github.com> * Remove automatic triggers and keep only manual workflow dispatch Co-authored-by: darthkali <46423967+darthkali@users.noreply.github.com> * Remove version input and rename workflow to build.yaml Co-authored-by: darthkali <46423967+darthkali@users.noreply.github.com> * Remove tar artifacts and push images directly to GHCR Co-authored-by: jenslehnhoff <1427862+jenslehnhoff@users.noreply.github.com> * Remove unused CI=true build args and rename jobs to include push Co-authored-by: jenslehnhoff <1427862+jenslehnhoff@users.noreply.github.com> * Rename workflow from "Build Pipeline" to "Build & Push" Co-authored-by: jenslehnhoff <1427862+jenslehnhoff@users.noreply.github.com> * Rename workflow file from build.yaml to build-and-push.yaml Co-authored-by: jenslehnhoff <1427862+jenslehnhoff@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: darthkali <46423967+darthkali@users.noreply.github.com> Co-authored-by: jenslehnhoff <1427862+jenslehnhoff@users.noreply.github.com>
1 parent de6c5f2 commit 4ccf9da

File tree

2 files changed

+107
-98
lines changed

2 files changed

+107
-98
lines changed
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
---
2+
name: Build & Push
3+
4+
# Migrated from GitLab CI - supports manual dispatch
5+
"on":
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
packages: write
11+
12+
jobs:
13+
# Build and push frontend container - migrated from build-container-ui
14+
build-and-push-frontend:
15+
runs-on: ubuntu-latest
16+
permissions:
17+
contents: read
18+
packages: write
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- name: Set version
23+
id: version
24+
run: |
25+
if [ "${{ github.ref_type }}" == "tag" ]; then
26+
echo "VERSION=${{ github.ref_name }}" >> $GITHUB_ENV
27+
else
28+
echo "VERSION=${{ github.sha }}" >> $GITHUB_ENV
29+
fi
30+
echo "SHORT_SHA=${GITHUB_SHA:0:8}" >> $GITHUB_ENV
31+
# Set image name for frontend
32+
RAG_EVAL_UI_IMAGE="ghcr.io/${{ github.repository }}/rag-eval-ui"
33+
echo "RAG_EVAL_UI_IMAGE=${RAG_EVAL_UI_IMAGE}" >> $GITHUB_ENV
34+
35+
- uses: docker/setup-buildx-action@v3
36+
37+
- name: Login to GitHub Container Registry
38+
uses: docker/login-action@v3
39+
with:
40+
registry: ghcr.io
41+
username: ${{ github.actor }}
42+
password: ${{ secrets.GITHUB_TOKEN }}
43+
44+
- name: Build and push frontend container
45+
uses: docker/build-push-action@v6
46+
with:
47+
context: frontend/
48+
file: frontend/Dockerfile
49+
build-args: |
50+
VERSION=${{ env.VERSION }}
51+
push: true
52+
tags: |
53+
${{ env.RAG_EVAL_UI_IMAGE }}:${{ env.SHORT_SHA }}
54+
${{ github.ref_type == 'tag' &&
55+
format('{0}:{1}', env.RAG_EVAL_UI_IMAGE,
56+
github.ref_name) || '' }}
57+
cache-from: type=gha
58+
cache-to: type=gha,mode=max
59+
60+
# Build and push backend container - migrated from build-container-backend
61+
build-and-push-backend:
62+
runs-on: ubuntu-latest
63+
permissions:
64+
contents: read
65+
packages: write
66+
steps:
67+
- uses: actions/checkout@v4
68+
69+
- name: Set version
70+
id: version
71+
run: |
72+
if [ "${{ github.ref_type }}" == "tag" ]; then
73+
echo "VERSION=${{ github.ref_name }}" >> $GITHUB_ENV
74+
else
75+
echo "VERSION=${{ github.sha }}" >> $GITHUB_ENV
76+
fi
77+
echo "SHORT_SHA=${GITHUB_SHA:0:8}" >> $GITHUB_ENV
78+
# Set image name for backend
79+
LLM_EVAL_BACKEND_IMAGE="ghcr.io/${{ github.repository }}"
80+
LLM_EVAL_BACKEND_IMAGE="${LLM_EVAL_BACKEND_IMAGE}/llm-eval-backend"
81+
echo "LLM_EVAL_BACKEND_IMAGE=${LLM_EVAL_BACKEND_IMAGE}" >> \
82+
$GITHUB_ENV
83+
84+
- uses: docker/setup-buildx-action@v3
85+
86+
- name: Login to GitHub Container Registry
87+
uses: docker/login-action@v3
88+
with:
89+
registry: ghcr.io
90+
username: ${{ github.actor }}
91+
password: ${{ secrets.GITHUB_TOKEN }}
92+
93+
- name: Build and push backend container
94+
uses: docker/build-push-action@v6
95+
with:
96+
context: backend/
97+
file: backend/Dockerfile
98+
build-args: |
99+
VERSION=${{ env.VERSION }}
100+
push: true
101+
tags: |
102+
${{ env.LLM_EVAL_BACKEND_IMAGE }}:${{ env.SHORT_SHA }}
103+
${{ github.ref_type == 'tag' &&
104+
format('{0}:{1}', env.LLM_EVAL_BACKEND_IMAGE,
105+
github.ref_name) || '' }}
106+
cache-from: type=gha
107+
cache-to: type=gha,mode=max

.github/workflows/gitlab-migration-build.yaml

Lines changed: 0 additions & 98 deletions
This file was deleted.

0 commit comments

Comments
 (0)