File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ node_modules
2+ dist
3+ .git
4+ .github
5+ npm-debug.log *
6+ yarn-error.log *
7+ .DS_Store
Original file line number Diff line number Diff line change 1+ name : CI
2+
3+ on :
4+ pull_request :
5+ branches :
6+ - main
7+ - develop
8+
9+ jobs :
10+ build :
11+ runs-on : ubuntu-latest
12+ steps :
13+ - name : Checkout
14+ uses : actions/checkout@v4
15+
16+ - name : Setup Node.js
17+ uses : actions/setup-node@v4
18+ with :
19+ node-version : 20
20+ cache : npm
21+
22+ - name : Install dependencies
23+ run : npm install
24+
25+ - name : Build
26+ run : npm run build
Original file line number Diff line number Diff line change 1+ name : Build & Deploy to Dev
2+
3+ on :
4+ push :
5+ branches :
6+ - develop
7+ workflow_dispatch :
8+
9+ permissions :
10+ contents : read
11+ packages : write
12+
13+ env :
14+ IMAGE_TAG : dev
15+
16+ jobs :
17+ build-dev :
18+ runs-on : ubuntu-latest
19+ steps :
20+ - name : Checkout
21+ uses : actions/checkout@v4
22+
23+ - name : Login to GitHub Container Registry
24+ uses : docker/login-action@v3
25+ with :
26+ registry : ghcr.io
27+ username : ${{ github.actor }}
28+ password : ${{ secrets.GITHUB_TOKEN }}
29+
30+ - name : Normalize registry owner
31+ run : echo "REGISTRY_OWNER_LC=${GITHUB_REPOSITORY_OWNER,,}" >> "$GITHUB_ENV"
32+
33+ - name : Build & push docker images
34+ run : make docker ENVIRONMENT=-dev IMAGE_TAG=${{ env.IMAGE_TAG }} REGISTRY_HOST=ghcr.io/${{ env.REGISTRY_OWNER_LC }}
35+
36+ deploy :
37+ needs : build-dev
38+ runs-on : ubuntu-latest
39+ steps :
40+ - name : Deploy to DEV server via SSH
41+ uses : appleboy/ssh-action@v1
42+ with :
43+ host : ${{ secrets.DEV_SERVER_HOST }}
44+ username : ${{ secrets.DEV_SERVER_USER }}
45+ key : ${{ secrets.DEV_SERVER_SSH_KEY }}
46+ script : ${{ secrets.DEV_DEPLOY_SCRIPT }}
Original file line number Diff line number Diff line change 1+ FROM node:20-alpine AS builder
2+
3+ WORKDIR /app
4+
5+ COPY package.json package-lock.json ./
6+
7+ # The lockfile currently contains local file: dependencies.
8+ # npm install resolves dependencies from package.json for CI/container builds.
9+ RUN npm install
10+
11+ COPY . .
12+ RUN npm run build
13+
14+ FROM nginx:1.27-alpine AS runner
15+
16+ COPY --from=builder /app/dist /usr/share/nginx/html
17+
18+ EXPOSE 80
19+
20+ HEALTHCHECK --interval=30s --timeout=3s --start-period=10s --retries=3 \
21+ CMD wget --no-verbose --tries=1 --spider http://localhost/ || exit 1
22+
23+ CMD ["nginx" , "-g" , "daemon off;" ]
Original file line number Diff line number Diff line change 1+ # Makefile Variables.
2+ include config.mk
3+
4+ # Docker BuildKit.
5+ export DOCKER_BUILDKIT =1
6+
7+ .PHONY : build push docker help
8+
9+ build : # # Build rgb-sdk-web-playground docker image.
10+ docker build -f ./Dockerfile -t $(IMAGE_RGB_SDK_WEB_PLAYGROUND_BACKUP ) -t $(IMAGE_RGB_SDK_WEB_PLAYGROUND_LATEST ) .
11+
12+ push : # # Push rgb-sdk-web-playground docker image.
13+ docker push $(IMAGE_RGB_SDK_WEB_PLAYGROUND_BACKUP ) && \
14+ docker push $(IMAGE_RGB_SDK_WEB_PLAYGROUND_LATEST )
15+
16+ docker : # # Build and push docker images.
17+ make build push
18+
19+ help : # # Show this help.
20+ @grep -E ' ^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST ) | sort | awk ' BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
Original file line number Diff line number Diff line change 1+ # Variables.
2+ ENVIRONMENT ?=
3+ IMAGE_TAG ?= latest
4+ REGISTRY_HOST ?= ghcr.io/utexo-protocol
5+ CURRENT_DATE_TIME := $(shell date +'% Y-% m-% d')
6+ LATEST_COMMIT := $$(git rev-parse --short HEAD )
7+
8+ # Image names.
9+ RGB_SDK_WEB_PLAYGROUND_IMAGE := rgb-sdk-web-playground
10+
11+ # Variables for build.
12+ IMAGE_RGB_SDK_WEB_PLAYGROUND_BACKUP = $(REGISTRY_HOST ) /$(RGB_SDK_WEB_PLAYGROUND_IMAGE )$(ENVIRONMENT ) :$(CURRENT_DATE_TIME ) -$(LATEST_COMMIT )
13+ IMAGE_RGB_SDK_WEB_PLAYGROUND_LATEST = $(REGISTRY_HOST ) /$(RGB_SDK_WEB_PLAYGROUND_IMAGE )$(ENVIRONMENT ) :$(IMAGE_TAG )
Original file line number Diff line number Diff line change @@ -4,20 +4,25 @@ import wasm from 'vite-plugin-wasm';
44import topLevelAwait from 'vite-plugin-top-level-await' ;
55import { nodePolyfills } from 'vite-plugin-node-polyfills' ;
66import path from 'path' ;
7+ import fs from 'fs' ;
78import { fileURLToPath } from 'url' ;
89import { createRequire } from 'module' ;
910
1011const require = createRequire ( import . meta. url ) ;
1112
1213const __dirname = path . dirname ( fileURLToPath ( import . meta. url ) ) ;
14+ const localRgbSdkCorePath = path . resolve ( __dirname , '../rgb-sdk-core/src/index.ts' ) ;
15+ const localAliases = fs . existsSync ( localRgbSdkCorePath )
16+ ? { '@utexo/rgb-sdk-core' : localRgbSdkCorePath }
17+ : { } ;
1318
1419export default defineConfig ( ( { mode } ) => {
1520 const env = loadEnv ( mode , __dirname , 'VITE_' ) ;
1621 return {
1722 resolve : {
18- alias : {
19- '@utexo/rgb-sdk-core' : path . resolve ( __dirname , '../rgb-sdk-core/src/index.ts' ) ,
20- } ,
23+ // Use local sibling core package only when it exists (local monorepo dev).
24+ // In CI/Docker this path does not exist, so Vite should resolve from npm package.
25+ alias : localAliases ,
2126 } ,
2227 build : {
2328 rollupOptions : {
You can’t perform that action at this time.
0 commit comments