Skip to content

Commit

Permalink
deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
JiangShuuu committed Nov 15, 2023
1 parent fd03956 commit 705481c
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 4 deletions.
72 changes: 72 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: next-pdf-saas Build and Deploy

on:
push:
branches:
- main

jobs:
docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3 # git clone 專案

- name: create env file
run: |
cd client-chat
touch .env
echo DATABASE_URL=${{ secrets.DATABASE_URL }} >> .env
echo UPLOADTHING_SECRET=${{ secrets.UPLOADTHING_SECRET }} >> .env
echo UPLOADTHING_APP_ID=${{ secrets.UPLOADTHING_APP_ID }} >> .env
echo PINECONE_API_KEY=${{ secrets.PINECONE_API_KEY }} >> .env
echo OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }} >> .env
echo STRIPE_PRODUCT_ID=${{ secrets.STRIPE_PRODUCT_ID }} >> .env
echo STRIPE_SECRET_KEY=${{ secrets.STRIPE_SECRET_KEY }} >> .env
echo STRIPE_WEBHOOK_SECRET=${{ secrets.STRIPE_WEBHOOK_SECRET }} >> .env
echo GITHUB_ID=${{ secrets.GITHUB_ID }} >> .env
echo GITHUB_SECRET=${{ secrets.GITHUB_SECRET }} >> .env
echo GOOGLE_CLIENT_ID=${{ secrets.GOOGLE_CLIENT_ID }} >> .env
echo GOOGLE_CLIENT_SECRET=${{ secrets.GOOGLE_CLIENT_SECRET }} >> .env
echo NEXTAUTH_SECRET=${{ secrets.NEXTAUTH_SECRET }} >> .env
- name: Use Node.js Install & Run build # Node
uses: actions/setup-node@v3
with:
node-version: 20

- name: cd file and install
run: |
cd client-chat
pnpm install
pnpm run build
- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v3
with:
context: .
file: ./docker/dockerfile
push: true
platforms: linux/arm64
tags: ${{ secrets.DOCKERHUB_USERNAME }}/pdfsaas:latest

- name: Run Deploy
uses: appleboy/ssh-action@master
with:
command_timeout: 4m
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
script: |
${{secrets.DOCKER_SCRIPT}}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ yarn-error.log*
# local env files
.env
.env.local
.env.prod

# vercel
.vercel
Expand Down
4 changes: 2 additions & 2 deletions docker/dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static

USER nextjs

EXPOSE 3000
EXPOSE 3001

ENV PORT 3000
ENV PORT 3001
# set hostname to localhost
ENV HOSTNAME "0.0.0.0"

Expand Down
4 changes: 2 additions & 2 deletions src/pages/api/auth/[...nextauth].ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ export const authOptions: AuthOptions = {
adapter: PrismaAdapter(db),
providers: [
GithubProvider({
clientId: process.env.GITHUB_ID as string,
clientSecret: process.env.GITHUB_SECRET as string
clientId: process.env.THIRT_GITHUB_ID as string,
clientSecret: process.env.THIRT_GITHUB_SECRET as string
}),
GoogleProvider({
clientId: process.env.GOOGLE_CLIENT_ID as string,
Expand Down

0 comments on commit 705481c

Please sign in to comment.