Skip to content

Commit 31592b6

Browse files
committed
Embed Gate app into Thunder
1 parent 75e057a commit 31592b6

13 files changed

Lines changed: 4364 additions & 3365 deletions

File tree

.github/workflows/release.yml

Lines changed: 52 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,10 @@ jobs:
130130
OS="${platform%%:*}"
131131
ARCH="${platform#*:}"
132132
133-
echo "🔨 Building Thunder backend for $OS/$ARCH..."
133+
echo "🔨 Building Thunder backend & frontend for $OS/$ARCH..."
134134
make build_backend OS=$OS ARCH=$ARCH
135-
135+
make build_frontend OS=$OS ARCH=$ARCH
136+
136137
# Optional: Add a small delay to prevent resource contention
137138
sleep 1
138139
done
@@ -163,58 +164,59 @@ jobs:
163164
git tag -a "$TAG_VERSION" -m "Release $TAG_VERSION"
164165
git push origin "$TAG_VERSION"
165166
166-
- name: 🐳 Set up Docker Buildx
167-
uses: docker/setup-buildx-action@v3
167+
# Docker steps skipped for this release
168+
# - name: 🐳 Set up Docker Buildx
169+
# uses: docker/setup-buildx-action@v3
168170

169-
- name: 🔐 Log in to GitHub Container Registry
170-
uses: docker/login-action@v3
171-
with:
172-
registry: ghcr.io
173-
username: ${{ github.actor }}
174-
password: ${{ secrets.GITHUB_TOKEN }}
171+
# - name: 🔐 Log in to GitHub Container Registry
172+
# uses: docker/login-action@v3
173+
# with:
174+
# registry: ghcr.io
175+
# username: ${{ github.actor }}
176+
# password: ${{ secrets.GITHUB_TOKEN }}
175177

176-
- name: 📥 Download Shared Certificates for Docker
177-
uses: actions/download-artifact@v4
178-
with:
179-
name: thunder-certificates
180-
path: target/out/.cert/
178+
# - name: 📥 Download Shared Certificates for Docker
179+
# uses: actions/download-artifact@v4
180+
# with:
181+
# name: thunder-certificates
182+
# path: target/out/.cert/
181183

182-
- name: 📋 Prepare Docker Build Context
183-
run: |
184-
# Copy certificates into the Docker build context
185-
mkdir -p docker-certs
186-
cp target/out/.cert/server.cert docker-certs/
187-
cp target/out/.cert/server.key docker-certs/
188-
echo "✅ Certificates prepared for Docker build context"
184+
# - name: 📋 Prepare Docker Build Context
185+
# run: |
186+
# # Copy certificates into the Docker build context
187+
# mkdir -p docker-certs
188+
# cp target/out/.cert/server.cert docker-certs/
189+
# cp target/out/.cert/server.key docker-certs/
190+
# echo "✅ Certificates prepared for Docker build context"
189191

190-
- name: 🐳 Build and Push Multi-Arch Docker Image
191-
run: |
192-
# Convert repository name to lowercase for GHCR
193-
REPO_NAME=$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]')
194-
IMAGE_NAME="ghcr.io/${REPO_NAME}"
195-
196-
# Get version without 'v' prefix for Docker tags
197-
DOCKER_VERSION="${{ github.event.inputs.version }}"
198-
if [[ $DOCKER_VERSION == v* ]]; then
199-
DOCKER_VERSION="${DOCKER_VERSION#v}"
200-
fi
201-
202-
echo "🐳 Building and pushing Docker image: ${IMAGE_NAME}:${DOCKER_VERSION}"
203-
204-
# Build and push multi-arch image with version and latest tags
205-
# Pass shared certificates as build context with paths relative to build context
206-
docker buildx build \
207-
--platform linux/amd64,linux/arm64 \
208-
--tag "${IMAGE_NAME}:${DOCKER_VERSION}" \
209-
--tag "${IMAGE_NAME}:latest" \
210-
--build-arg CERT_FILE=docker-certs/server.cert \
211-
--build-arg KEY_FILE=docker-certs/server.key \
212-
--push \
213-
.
214-
215-
echo "✅ Docker image pushed successfully!"
216-
echo "📦 Image available at: ${IMAGE_NAME}:${DOCKER_VERSION}"
217-
echo "📦 Image available at: ${IMAGE_NAME}:latest"
192+
# - name: 🐳 Build and Push Multi-Arch Docker Image
193+
# run: |
194+
# # Convert repository name to lowercase for GHCR
195+
# REPO_NAME=$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]')
196+
# IMAGE_NAME="ghcr.io/${REPO_NAME}"
197+
#
198+
# # Get version without 'v' prefix for Docker tags
199+
# DOCKER_VERSION="${{ github.event.inputs.version }}"
200+
# if [[ $DOCKER_VERSION == v* ]]; then
201+
# DOCKER_VERSION="${DOCKER_VERSION#v}"
202+
# fi
203+
#
204+
# echo "🐳 Building and pushing Docker image: ${IMAGE_NAME}:${DOCKER_VERSION}"
205+
#
206+
# # Build and push multi-arch image with version and latest tags
207+
# # Pass shared certificates as build context with paths relative to build context
208+
# docker buildx build \
209+
# --platform linux/amd64,linux/arm64 \
210+
# --tag "${IMAGE_NAME}:${DOCKER_VERSION}" \
211+
# --tag "${IMAGE_NAME}:latest" \
212+
# --build-arg CERT_FILE=docker-certs/server.cert \
213+
# --build-arg KEY_FILE=docker-certs/server.key \
214+
# --push \
215+
# .
216+
#
217+
# echo "✅ Docker image pushed successfully!"
218+
# echo "📦 Image available at: ${IMAGE_NAME}:${DOCKER_VERSION}"
219+
# echo "📦 Image available at: ${IMAGE_NAME}:latest"
218220

219221
- name: 📝 Calculate Next Version
220222
id: next_version

Dockerfile

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,17 @@
1717
# ----------------------------------------------------------------------------
1818

1919
# WSO2 Thunder Docker Image
20-
# Build stage - compile the Go binary for the target architecture
20+
# Build stage - compile the Go binary and build frontend for the target architecture
2121
FROM golang:1.25-alpine AS builder
2222

23-
# Install build dependencies
24-
RUN apk add --no-cache git make bash sqlite openssl zip
23+
# Install build dependencies including Node.js and npm
24+
RUN apk add --no-cache git make bash sqlite openssl zip nodejs npm
25+
26+
# Install pnpm globally
27+
RUN npm install -g pnpm
28+
29+
# Set environment variables for CI build
30+
ENV CI=true
2531

2632
# Set the working directory
2733
WORKDIR /app
@@ -53,12 +59,12 @@ RUN if [ -n "$CERT_FILE" ] && [ -n "$KEY_FILE" ] && [ -f "$CERT_FILE" ] && [ -f
5359
echo "✅ New certificates generated"; \
5460
fi
5561

56-
# Build the binary for the target architecture
62+
# Build both frontend and backend for the target architecture
5763
ARG TARGETARCH
5864
RUN if [ "$TARGETARCH" = "amd64" ]; then \
59-
./build.sh build_backend linux amd64; \
65+
./build.sh build linux amd64; \
6066
else \
61-
./build.sh build_backend linux arm64; \
67+
./build.sh build linux arm64; \
6268
fi
6369

6470
# List the contents of the dist directory to verify zip output
@@ -104,11 +110,15 @@ RUN chown -R thunder:thunder /opt/thunder && \
104110
# Expose the default port
105111
EXPOSE 8090
106112

113+
# Expose the Gate port
114+
EXPOSE 9090
115+
107116
# Switch to thunder user
108117
USER thunder
109118

110119
# Set environment variables
111120
ENV BACKEND_PORT=8090
121+
ENV FRONTEND_PORT=9090
112122

113123
# Start the application
114124
CMD ["./start.sh"]

Makefile

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,14 @@ clean_all:
4444
clean:
4545
./build.sh clean $(OS) $(ARCH)
4646

47-
build: build_backend build_samples
47+
build: build_backend build_frontend build_samples
4848

4949
build_backend:
5050
./build.sh build_backend $(OS) $(ARCH)
5151

52+
build_frontend:
53+
./build.sh build_frontend
54+
5255
package_samples:
5356
./build.sh package_samples $(OS) $(ARCH)
5457

@@ -70,6 +73,7 @@ build_with_coverage:
7073
@echo "================================================================"
7174
./build.sh test_unit $(OS) $(ARCH)
7275
ENABLE_COVERAGE=true ./build.sh build_backend $(OS) $(ARCH)
76+
./build.sh build_frontend
7377
./build.sh test_integration $(OS) $(ARCH)
7478
./build.sh merge_coverage $(OS) $(ARCH)
7579
@echo "================================================================"
@@ -101,8 +105,9 @@ help:
101105
@echo " backend - Clean, build, and test only the backend."
102106
@echo " clean - Remove build artifacts."
103107
@echo " clean_all - Remove all build artifacts including distribution files."
104-
@echo " build - Build the Go project and frontend, then package."
108+
@echo " build - Build the complete Thunder application (backend + frontend + samples)."
105109
@echo " build_backend - Build the backend Go application."
110+
@echo " build_frontend - Build the Next.js frontend applications."
106111
@echo " package_samples - Package sample applications."
107112
@echo " build_samples - Build sample applications."
108113
@echo " test_unit - Run unit tests."
@@ -118,7 +123,7 @@ help:
118123
@echo " lint - Run golangci-lint on the project."
119124
@echo " help - Show this help message."
120125

121-
.PHONY: all prepare clean clean_all build build_samples package_samples run
126+
.PHONY: all prepare clean clean_all build build_backend build_frontend build_samples package_samples run
122127
.PHONY: docker-build docker-build-latest docker-build-multiarch
123128
.PHONY: docker-build-multiarch-latest docker-build-multiarch-push
124129
.PHONY: test_unit test_integration build_with_coverage test

0 commit comments

Comments
 (0)