Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 0 additions & 63 deletions .github/workflows/ci.yml

This file was deleted.

47 changes: 0 additions & 47 deletions .github/workflows/docker-build.yml

This file was deleted.

78 changes: 78 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Tests
on:
workflow_dispatch:
push:
branches:
- main
- develop
pull_request:
branches:
- main
- develop
jobs:
test-and-build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version:
- 18.x
- 20.x
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run ESLint
run: npm run lint
continue-on-error: true
- name: Run type checking
run: npm run build -- --mode lib
continue-on-error: true
- name: Check TypeScript compilation
run: tsc --noEmit
- name: Run tests
run: npm test -- --run
continue-on-error: true
- name: Build production bundle
run: npm run build
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: dist-node-${{ matrix.node-version }}
path: dist/
retention-days: 5
- name: Report build summary
run: |
echo "## Build Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "✓ TypeScript type checking passed" >> $GITHUB_STEP_SUMMARY
echo "✓ Production build successful" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Artifacts:**" >> $GITHUB_STEP_SUMMARY
echo "- dist/ directory built with Node ${{ matrix.node-version }}" >> $GITHUB_STEP_SUMMARY
push-to-gitlab:
name: Push to GitLab
runs-on: ubuntu-latest
needs:
- test-and-build
if: always() && needs.test-and-build.result == 'success'
steps:
- name: Checkout code
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Push to GitLab
env:
GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }}
run: |
git config user.name "GitHub Actions"
git config user.email "actions@github.com"
git remote add gitlab https://gitlab.com/dk-raas/dkai/high-command/high-command-ui.git || true
git config credential.helper '!f() { echo "username=oauth2"; echo "password=${GITLAB_TOKEN}"; }; f'
git fetch gitlab main || true
git push gitlab HEAD:main || echo "GitLab push failed"
39 changes: 39 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
stages:
- build

variables:
HARBOR_REGISTRY: harbor.dataknife.net
HARBOR_PROJECT: library
IMAGE_NAME: high-command-ui

docker-build:
stage: build
image: docker:latest
services:
- docker:dind
before_script:
- echo "$HARBOR_PASSWORD" | docker login -u "$HARBOR_USERNAME" --password-stdin $HARBOR_REGISTRY
script:
- |
# Build image once
docker build -t $HARBOR_REGISTRY/$HARBOR_PROJECT/$IMAGE_NAME:latest .

# Tag with commit SHA
docker tag $HARBOR_REGISTRY/$HARBOR_PROJECT/$IMAGE_NAME:latest \
$HARBOR_REGISTRY/$HARBOR_PROJECT/$IMAGE_NAME:$CI_COMMIT_SHORT_SHA

# Push images
docker push $HARBOR_REGISTRY/$HARBOR_PROJECT/$IMAGE_NAME:latest
docker push $HARBOR_REGISTRY/$HARBOR_PROJECT/$IMAGE_NAME:$CI_COMMIT_SHORT_SHA

# Tag with version if tag exists
if [ -n "$CI_COMMIT_TAG" ]; then
docker tag $HARBOR_REGISTRY/$HARBOR_PROJECT/$IMAGE_NAME:latest \
$HARBOR_REGISTRY/$HARBOR_PROJECT/$IMAGE_NAME:$CI_COMMIT_TAG
docker push $HARBOR_REGISTRY/$HARBOR_PROJECT/$IMAGE_NAME:$CI_COMMIT_TAG
fi
rules:
- if: '$CI_COMMIT_BRANCH == "main"'
- if: '$CI_COMMIT_TAG'
tags:
- docker
26 changes: 26 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ help:
@echo ""
@echo "Docker Targets:"
@echo " make docker-build - Build Docker image"
@echo " make docker-login - Login to Harbor registry (requires HARBOR_USERNAME and HARBOR_PASSWORD)"
@echo " make docker-push - Build and push image to Harbor registry"
@echo " make docker-pull - Pull image from Harbor registry"
@echo " make docker-run - Run Docker container (port 3000)"
@echo " make docker-dev - Run development container with hot reload"
@echo " make docker-stop - Stop Docker container"
Expand Down Expand Up @@ -104,8 +107,31 @@ clean:
npm cache clean --force

# Docker commands
HARBOR_REGISTRY := harbor.dataknife.net
APP_NAME := high-command-ui
HARBOR_IMAGE := $(HARBOR_REGISTRY)/library/$(APP_NAME)
IMAGE_TAG ?= latest

docker-login:
@echo "Logging into Harbor registry..."
@if [ -z "$$HARBOR_USERNAME" ] || [ -z "$$HARBOR_PASSWORD" ]; then \
echo "Error: HARBOR_USERNAME and HARBOR_PASSWORD must be set"; \
exit 1; \
fi
@printf '%s\n' "$$HARBOR_PASSWORD" | docker login $(HARBOR_REGISTRY) \
-u "$$HARBOR_USERNAME" \
--password-stdin

docker-build:
docker build -t high-command-ui:latest .
docker tag high-command-ui:latest $(HARBOR_IMAGE):$(IMAGE_TAG)

docker-push: docker-build docker-login
Comment thread
surrealwolf marked this conversation as resolved.
docker push $(HARBOR_IMAGE):$(IMAGE_TAG)

docker-pull:
docker pull $(HARBOR_IMAGE):$(IMAGE_TAG)
docker tag $(HARBOR_IMAGE):$(IMAGE_TAG) high-command-ui:latest

docker-run: docker-build
docker run -d --name high-command-ui -p 3000:3000 \
Expand Down
6 changes: 2 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ version: '3.8'

services:
high-command-ui:
build:
context: .
dockerfile: Dockerfile
image: harbor.dataknife.net/library/high-command-ui:latest
container_name: high-command-ui
ports:
- "3000:3000"
Expand All @@ -22,7 +20,7 @@ services:
start_period: 10s

high-command-api:
image: high-command-api:latest
image: harbor.dataknife.net/library/high-command-api:latest
container_name: high-command-api
ports:
- "3001:3001"
Expand Down
Loading