Compare commits

...

1 Commits

Author SHA1 Message Date
Rafi
55279def0d Add Dockerfile and workflow for static hosting image. 2023-04-11 15:32:06 +08:00
6 changed files with 63 additions and 5 deletions

View File

@@ -1,4 +1,6 @@
node_modules
database.sqlite
dist
.idea
.output
.nuxt
.env

View File

@@ -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

1
.gitignore vendored
View File

@@ -7,4 +7,3 @@ node_modules
.env
.idea
dist
database.sqlite

View File

@@ -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;

View File

@@ -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,

22
static.Dockerfile Normal file
View File

@@ -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