Skip to content

Commit 7c8b84a

Browse files
authored
Merge pull request #133 from anshul7665/main
Adding UI build step to release workflow
2 parents 67a54f8 + 8187065 commit 7c8b84a

File tree

2 files changed

+48
-9
lines changed

2 files changed

+48
-9
lines changed

.github/workflows/docker_build.yaml

Lines changed: 46 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,8 @@ jobs:
123123
sleep 5
124124
git ls-remote --tags origin | grep "refs/tags/${{ steps.tag_version.outputs.next_version }}" || (echo "Tag push verification failed!" && exit 1)
125125
echo "Tag successfully pushed."
126-
127-
build_and_push_docker_image:
126+
127+
build_and_push_backend_image:
128128
runs-on: ubuntu-latest
129129
needs: tag_release # Depends on the tag being created successfully
130130
permissions:
@@ -156,7 +156,7 @@ jobs:
156156
# Optionally add 'latest' tag if building from the default branch
157157
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) || github.event.inputs.branch == github.event.repository.default_branch }}
158158
159-
- name: Build and push Docker image
159+
- name: Build and push surfsense backend
160160
uses: docker/build-push-action@v5
161161
with:
162162
context: ./surfsense_backend
@@ -166,3 +166,46 @@ jobs:
166166
# Optional: Add build cache for faster builds
167167
cache-from: type=gha
168168
cache-to: type=gha,mode=max
169+
170+
build_and_push_ui_image:
171+
runs-on: ubuntu-latest
172+
needs: tag_release # Depends on the tag being created successfully
173+
permissions:
174+
packages: write # Need permission to write to GHCR
175+
contents: read # Need permission to read repo contents (checkout)
176+
177+
steps:
178+
- name: Checkout code
179+
uses: actions/checkout@v4
180+
181+
- name: Login to GitHub Container Registry
182+
uses: docker/login-action@v3
183+
with:
184+
registry: ghcr.io
185+
username: ${{ github.repository_owner }}
186+
password: ${{ secrets.GITHUB_TOKEN }}
187+
188+
- name: Set up Docker Buildx
189+
uses: docker/setup-buildx-action@v3
190+
191+
- name: Extract metadata (tags, labels) for Docker build
192+
id: meta
193+
uses: docker/metadata-action@v5
194+
with:
195+
images: ghcr.io/${{ github.repository_owner }}/surfsense_ui
196+
tags: |
197+
# Use the tag generated in the previous job
198+
type=raw,value=${{ needs.tag_release.outputs.new_tag }}
199+
# Optionally add 'latest' tag if building from the default branch
200+
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) || github.event.inputs.branch == github.event.repository.default_branch }}
201+
202+
- name: Build and push surfsense UI image
203+
uses: docker/build-push-action@v5
204+
with:
205+
context: ./surfsense_web
206+
push: true
207+
tags: ${{ steps.meta.outputs.tags }}
208+
labels: ${{ steps.meta.outputs.labels }}
209+
# Optional: Add build cache for faster builds
210+
cache-from: type=gha
211+
cache-to: type=gha,mode=max

docker-compose.override.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@ version: '3.8'
22

33
services:
44
frontend:
5-
build:
6-
context: ./surfsense_web
7-
dockerfile: Dockerfile
5+
image: ghcr.io/modsetter/surfsense_ui:latest
86
ports:
97
- "${FRONTEND_PORT:-3000}:3000"
108
volumes:
@@ -16,9 +14,7 @@ services:
1614
- NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL:-http://backend:8000}
1715

1816
backend:
19-
build:
20-
context: ./surfsense_backend
21-
dockerfile: Dockerfile
17+
image: ghcr.io/modsetter/surfsense_backend:latest
2218
ports:
2319
- "${BACKEND_PORT:-8000}:8000"
2420
volumes:

0 commit comments

Comments
 (0)