From 09a724bf958afe83746340ce57cd5dbb0982434b Mon Sep 17 00:00:00 2001 From: 0xzion <0xzion.penx@gmail.com> Date: Tue, 23 Apr 2024 19:53:40 +0800 Subject: [PATCH] chore: create image script --- .github/workflows/create-images.yml | 40 +++++++++++++ Dockerfile | 2 +- apps/web/.env | 28 ++++++++- apps/web/.env.local.example | 27 --------- apps/web/src/pages/cli-login.tsx | 92 ++++++++++++++--------------- pnpm-lock.yaml | 8 +-- 6 files changed, 117 insertions(+), 80 deletions(-) create mode 100644 .github/workflows/create-images.yml diff --git a/.github/workflows/create-images.yml b/.github/workflows/create-images.yml new file mode 100644 index 000000000..413fdaa7c --- /dev/null +++ b/.github/workflows/create-images.yml @@ -0,0 +1,40 @@ +name: Create docker images (manual) + +on: + push: + branches: + - main + +jobs: + build: + name: Build, push, and deploy + runs-on: ubuntu-latest + + strategy: + matrix: + db-type: [postgresql, mysql] + + steps: + - uses: actions/checkout@v3 + + - uses: mr-smithers-excellent/docker-build-push@v6 + name: Build & push Docker image to docker.io for ${{ matrix.db-type }} + with: + image: 0xzion/penx + tags: ${{ matrix.db-type }}-latest + buildArgs: DATABASE_TYPE=${{ matrix.db-type }} + registry: docker.io + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - uses: mr-smithers-excellent/docker-build-push@v6 + name: Build & push Docker image to ghcr.io for ${{ matrix.db-type }} + with: + image: penx + tags: ${{ matrix.db-type }}-latest + buildArgs: DATABASE_TYPE=${{ matrix.db-type }} + registry: ghcr.io + multiPlatform: true + platform: linux/amd64,linux/arm64 + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 26195994e..e229cd5b9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -41,7 +41,7 @@ ENV DATABASE_URL=${DATABASE_URL} ARG NEXT_PUBLIC_DEPLOY_MODE=SELF_HOSTED RUN turbo run build --filter=@penx/db -RUN turbo build --filter=web... +RUN turbo run build --filter=web... FROM base AS runner WORKDIR /app diff --git a/apps/web/.env b/apps/web/.env index f96c4d61d..67830fcb6 100644 --- a/apps/web/.env +++ b/apps/web/.env @@ -1,3 +1,27 @@ -NEXT_PUBLIC_IS_EARLY_STAGE=false +NEXT_PUBLIC_PROJECT_ID=75879ee8d0e1f47758a4bb4577361f08 -NEXT_PUBLIC_IS_SYNC_ENABLED=false \ No newline at end of file +NEXT_PUBLIC_PLATFORM=WEB + +NEXT_PUBLIC_IS_EARLY_STAGE=true + +NEXT_PUBLIC_IS_SYNC_ENABLED=false + +# Linux: `openssl rand -hex 32` or go to https://generate-secret.now.sh/32 +NEXTAUTH_SECRET=adb6e96b7ec73026c7562eff5f8b95ee + +NEXT_PUBLIC_LOCAL_RPC_URL=http://127.0.0.1:8545 +NEXT_PUBLIC_DEVELOP_RPC_URL=https://hardhat-develop.penx.io +NEXT_PUBLIC_SEPOLIA_RPC_URL=https://arb-sepolia.g.alchemy.com/v2/wBM5sKAU03PrPBOwO1dRfV7fQ87sc-4y + +# DEVELOP,SEPOLIA +# NEXT_PUBLIC_NETWORK=LOCAL +# NEXT_PUBLIC_NETWORK=DEVELOP +NEXT_PUBLIC_NETWORK=SEPOLIA + +# PLATFORM or SELF_HOSTED +# NEXT_PUBLIC_DEPLOY_MODE=SELF_HOSTED + +NEXT_PUBLIC_DEPLOY_MODE=PLATFORM + +SELF_HOSTED_USERNAME="penx" +SELF_HOSTED_PASSWORD="123456" diff --git a/apps/web/.env.local.example b/apps/web/.env.local.example index a93decbb0..6a60a02c2 100644 --- a/apps/web/.env.local.example +++ b/apps/web/.env.local.example @@ -1,36 +1,9 @@ -NEXT_PUBLIC_PROJECT_ID=75879ee8d0e1f47758a4bb4577361f08 - -NEXT_PUBLIC_PLATFORM=WEB - NEXT_PUBLIC_UMAMI_WEBSITE_ID=e9b42a6d-f88e-435a-9b8a-356a289f432f -NEXT_PUBLIC_LOCAL_RPC_URL=http://127.0.0.1:8545 -NEXT_PUBLIC_DEVELOP_RPC_URL=https://hardhat-develop.penx.io -NEXT_PUBLIC_SEPOLIA_RPC_URL=https://arb-sepolia.g.alchemy.com/v2/wBM5sKAU03PrPBOwO1dRfV7fQ87sc-4y - - -# DEVELOP,SEPOLIA -NEXT_PUBLIC_NETWORK=LOCAL -# NEXT_PUBLIC_NETWORK=DEVELOP -# NEXT_PUBLIC_NETWORK=SEPOLIA - -NEXT_PUBLIC_IS_EARLY_STAGE=false - -NEXT_PUBLIC_IS_SYNC_ENABLED=false - -# PLATFORM or SELF_HOSTED -# NEXT_PUBLIC_DEPLOY_MODE=SELF_HOSTED -NEXT_PUBLIC_DEPLOY_MODE=PLATFORM - -SELF_HOSTED_USERNAME="penx" -SELF_HOSTED_PASSWORD="123456" NEXTAUTH_URL=http://localhost:3000 NEXT_PUBLIC_NEXTAUTH_URL=http://localhost:3000 -# Linux: `openssl rand -hex 32` or go to https://generate-secret.now.sh/32 -NEXTAUTH_SECRET=adb6e96b7ec73026c7562eff5f8b95ee - NEXT_PUBLIC_NEXTAUTH_PROVIDERS=GOOGLE,GITHUB NEXT_PUBLIC_GOOGLE_CLIENT_ID=867419323004-jgr1sre86kr9braen5isovueejss0dti.apps.googleusercontent.com diff --git a/apps/web/src/pages/cli-login.tsx b/apps/web/src/pages/cli-login.tsx index 45dc4f3ec..53486d4b1 100644 --- a/apps/web/src/pages/cli-login.tsx +++ b/apps/web/src/pages/cli-login.tsx @@ -1,8 +1,9 @@ import React from 'react' import { Box } from '@fower/react' import { useRouter } from 'next/router' -import { Button, Spinner, toast, ToastContainer } from 'uikit' -import { api, trpc, TrpcProvider } from '@penx/trpc-client' +import { Button, Spinner, toast } from 'uikit' +import { api, trpc } from '@penx/trpc-client' +import { CommonLayout } from '~/layouts/CommonLayout' export default function CliLogin() { const { query, push } = useRouter() @@ -15,51 +16,50 @@ export default function CliLogin() { trpc.cli.confirmLogin.useMutation() return ( - - - - - Login to PenX CLI - - Please confirm your authorization for this login. + + + Login to PenX CLI + + Please confirm your authorization for this login. - - - - + + + - + ) } + +CliLogin.Layout = CommonLayout diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f34fe9d02..db1cfd0d9 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1700,7 +1700,7 @@ importers: version: 4.24.7(next@14.1.4(@babel/core@7.24.3)(@opentelemetry/api@1.8.0)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)(sass@1.72.0))(react-dom@18.2.0(react@18.2.0))(react@18.2.0) next-seo: specifier: ^6.5.0 - version: 6.5.0(next@14.1.4(@babel/core@7.24.3)(@opentelemetry/api@1.8.0)(babel-plugin-macros@3.1.0)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)(sass@1.72.0))(react-dom@18.2.0(react@18.2.0))(react@18.2.0) + version: 6.5.0(next@14.1.4(@babel/core@7.24.3)(@opentelemetry/api@1.8.0)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)(sass@1.72.0))(react-dom@18.2.0(react@18.2.0))(react@18.2.0) nextjs-cors: specifier: ^2.2.0 version: 2.2.0(next@14.1.4(@babel/core@7.24.3)(@opentelemetry/api@1.8.0)(babel-plugin-macros@3.1.0)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)(sass@1.72.0)) @@ -2616,7 +2616,7 @@ importers: version: 4.24.5(next@14.1.4(@babel/core@7.24.3)(@opentelemetry/api@1.8.0)(babel-plugin-macros@3.1.0)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)(sass@1.72.0))(react-dom@18.2.0(react@18.2.0))(react@18.2.0) next-seo: specifier: ^6.5.0 - version: 6.5.0(next@14.1.4(@babel/core@7.24.3)(@opentelemetry/api@1.8.0)(babel-plugin-macros@3.1.0)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)(sass@1.72.0))(react-dom@18.2.0(react@18.2.0))(react@18.2.0) + version: 6.5.0(next@14.1.4(@babel/core@7.24.3)(@opentelemetry/api@1.8.0)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)(sass@1.72.0))(react-dom@18.2.0(react@18.2.0))(react@18.2.0) nextjs-cors: specifier: ^2.2.0 version: 2.2.0(next@14.1.4(@babel/core@7.24.3)(@opentelemetry/api@1.8.0)(babel-plugin-macros@3.1.0)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)(sass@1.72.0)) @@ -39170,7 +39170,7 @@ snapshots: transitivePeerDependencies: - supports-color - next-seo@6.5.0(next@14.1.4(@babel/core@7.24.3)(@opentelemetry/api@1.8.0)(babel-plugin-macros@3.1.0)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)(sass@1.72.0))(react-dom@18.2.0(react@18.2.0))(react@18.2.0): + next-seo@6.5.0(next@14.1.4(@babel/core@7.24.3)(@opentelemetry/api@1.8.0)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)(sass@1.72.0))(react-dom@18.2.0(react@18.2.0))(react@18.2.0): dependencies: next: 14.1.4(@babel/core@7.24.3)(@opentelemetry/api@1.8.0)(babel-plugin-macros@3.1.0)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)(sass@1.72.0) react: 18.2.0 @@ -39233,7 +39233,7 @@ snapshots: intersection-observer: 0.12.2 match-sorter: 6.3.4 next: 14.1.4(@babel/core@7.24.3)(@opentelemetry/api@1.8.0)(babel-plugin-macros@3.1.0)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)(sass@1.72.0) - next-seo: 6.5.0(next@14.1.4(@babel/core@7.24.3)(@opentelemetry/api@1.8.0)(babel-plugin-macros@3.1.0)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)(sass@1.72.0))(react-dom@18.2.0(react@18.2.0))(react@18.2.0) + next-seo: 6.5.0(next@14.1.4(@babel/core@7.24.3)(@opentelemetry/api@1.8.0)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)(sass@1.72.0))(react-dom@18.2.0(react@18.2.0))(react@18.2.0) next-themes: 0.2.1(next@14.1.4(@babel/core@7.24.3)(@opentelemetry/api@1.8.0)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)(sass@1.72.0))(react-dom@18.2.0(react@18.2.0))(react@18.2.0) nextra: 2.13.4(next@14.1.4(@babel/core@7.24.3)(@opentelemetry/api@1.8.0)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)(sass@1.72.0))(react-dom@18.2.0(react@18.2.0))(react@18.2.0) react: 18.2.0