diff --git a/.dockerignore b/.dockerignore index b18b6fb..dd121b9 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,4 +1,6 @@ node_modules -database.sqlite +dist .idea +.output +.nuxt .env \ No newline at end of file diff --git a/.github/workflows/docker-image-static.yml b/.github/workflows/docker-image-static.yml new file mode 100644 index 0000000..dce3fd6 --- /dev/null +++ b/.github/workflows/docker-image-static.yml @@ -0,0 +1,36 @@ +name: Docker Image CI - static + +on: + release: + types: [published] + +jobs: + + build: + + runs-on: ubuntu-latest + + steps: + - + name: Checkout + uses: actions/checkout@v3 + - + name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - + name: Login to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - + name: Build and push + uses: docker/build-push-action@v4 + with: + context: . + file: static.Dockerfile + push: true + tags: wongsaang/chatgpt-ui-client:latest-static,wongsaang/chatgpt-ui-client:${{ github.ref_name }}-static diff --git a/.gitignore b/.gitignore index e85da20..a12cff6 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,3 @@ node_modules .env .idea dist -database.sqlite diff --git a/nginx.conf b/nginx.conf index a6a6b29..37c9e7f 100644 --- a/nginx.conf +++ b/nginx.conf @@ -2,9 +2,9 @@ server { listen 80; listen [::]:80; server_name localhost; + root /app; location / { - root /app; index index.html; try_files $uri $uri/ /index.html; diff --git a/nuxt.config.ts b/nuxt.config.ts index e14d24f..f3701f0 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -1,9 +1,8 @@ // https://nuxt.com/docs/api/configuration/nuxt-config const appName = process.env.NUXT_PUBLIC_APP_NAME ?? 'ChatGPT UI' - export default defineNuxtConfig({ debug: process.env.NODE_ENV !== 'production', - ssr: true, + ssr: process.env.SSR !== 'false', app: { head: { title: appName, diff --git a/static.Dockerfile b/static.Dockerfile new file mode 100644 index 0000000..199bdab --- /dev/null +++ b/static.Dockerfile @@ -0,0 +1,22 @@ +FROM node:18-alpine3.16 as builder + +WORKDIR /app + +COPY package.json yarn.lock ./ + +RUN yarn install + +COPY . . + +RUN rm -r server && SSR=false yarn generate + + +FROM nginx:1.22-alpine + +WORKDIR /app + +COPY --from=builder /app/.output/public . + +COPY nginx.conf /etc/nginx/templates/default.conf.template + +EXPOSE 80 \ No newline at end of file