Skip to content

Commit

Permalink
chore: create image script
Browse files Browse the repository at this point in the history
  • Loading branch information
0xzio committed Apr 23, 2024
1 parent c45b2bf commit eaf2935
Show file tree
Hide file tree
Showing 7 changed files with 128 additions and 80 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/create-images.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
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.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- uses: mr-smithers-excellent/docker-build-push@v6
name: Build & push Docker image to docker.io for ${{ matrix.db-type }}
with:
image: penxio/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: ${{ secrets.GHCR_USERNAME }}
password: ${{ secrets.GHCR_TOKEN }}
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
28 changes: 26 additions & 2 deletions apps/web/.env
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
NEXT_PUBLIC_IS_EARLY_STAGE=false
NEXT_PUBLIC_PROJECT_ID=75879ee8d0e1f47758a4bb4577361f08

NEXT_PUBLIC_IS_SYNC_ENABLED=false
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"
27 changes: 0 additions & 27 deletions apps/web/.env.local.example
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 1 addition & 0 deletions apps/web/next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import './src/env.mjs'
const __filename = fileURLToPath(import.meta.url) // get the resolved path to the file

const __dirname = path.dirname(__filename) // get the name of the directory
//
console.log('__dirname=========', __dirname)

const isDev = process.env.NODE_ENV === 'development'
Expand Down
92 changes: 46 additions & 46 deletions apps/web/src/pages/cli-login.tsx
Original file line number Diff line number Diff line change
@@ -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()
Expand All @@ -15,51 +16,50 @@ export default function CliLogin() {
trpc.cli.confirmLogin.useMutation()

return (
<TrpcProvider>
<ToastContainer position="bottom-right" />
<Box p10 h-100vh toCenter column bgWhite black gap4>
<Box text3XL fontBold>
Login to PenX CLI
</Box>
<Box gray500>Please confirm your authorization for this login.</Box>
<Box p10 h-100vh toCenter column bgWhite black gap4>
<Box text3XL fontBold>
Login to PenX CLI
</Box>
<Box gray500>Please confirm your authorization for this login.</Box>

<Box toCenterY gap2 mt6>
<Button
variant="outline"
colorScheme="white"
w-160
gap2
disabled={isCanceling}
onClick={async () => {
if (isCanceling) return
try {
await cancel({ token })
window.close()
} catch (error) {
toast.error('please try again')
}
}}
>
{isCanceling && <Spinner square5></Spinner>}
<Box>Cancel</Box>
</Button>
<Button
w-160
disabled={isConfirming}
onClick={async () => {
try {
await confirm({ token })
toast.error('CLI login successfully')
} catch (error) {
toast.error('please try again~')
}
}}
>
{isConfirming && <Spinner square5></Spinner>}
<Box>Authorize CLI login</Box>
</Button>
</Box>
<Box toCenterY gap2 mt6>
<Button
variant="outline"
colorScheme="white"
w-160
gap2
disabled={isCanceling}
onClick={async () => {
if (isCanceling) return
try {
await cancel({ token })
window.close()
} catch (error) {
toast.error('please try again')
}
}}
>
{isCanceling && <Spinner square5></Spinner>}
<Box>Cancel</Box>
</Button>
<Button
w-160
disabled={isConfirming}
onClick={async () => {
try {
await confirm({ token })
toast.error('CLI login successfully')
} catch (error) {
toast.error('please try again~')
}
}}
>
{isConfirming && <Spinner square5></Spinner>}
<Box>Authorize CLI login</Box>
</Button>
</Box>
</TrpcProvider>
</Box>
)
}

CliLogin.Layout = CommonLayout
8 changes: 4 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit eaf2935

Please sign in to comment.