Skip to content

Commit 55279de

Browse files
committed
Add Dockerfile and workflow for static hosting image.
1 parent fa14276 commit 55279de

File tree

6 files changed

+63
-5
lines changed

6 files changed

+63
-5
lines changed

.dockerignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
node_modules
2-
database.sqlite
2+
dist
33
.idea
4+
.output
5+
.nuxt
46
.env
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Docker Image CI - static
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
9+
build:
10+
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
-
15+
name: Checkout
16+
uses: actions/checkout@v3
17+
-
18+
name: Set up QEMU
19+
uses: docker/setup-qemu-action@v2
20+
-
21+
name: Set up Docker Buildx
22+
uses: docker/setup-buildx-action@v2
23+
-
24+
name: Login to Docker Hub
25+
uses: docker/login-action@v2
26+
with:
27+
username: ${{ secrets.DOCKERHUB_USERNAME }}
28+
password: ${{ secrets.DOCKERHUB_TOKEN }}
29+
-
30+
name: Build and push
31+
uses: docker/build-push-action@v4
32+
with:
33+
context: .
34+
file: static.Dockerfile
35+
push: true
36+
tags: wongsaang/chatgpt-ui-client:latest-static,wongsaang/chatgpt-ui-client:${{ github.ref_name }}-static

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,3 @@ node_modules
77
.env
88
.idea
99
dist
10-
database.sqlite

nginx.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ server {
22
listen 80;
33
listen [::]:80;
44
server_name localhost;
5+
root /app;
56

67
location / {
7-
root /app;
88
index index.html;
99

1010
try_files $uri $uri/ /index.html;

nuxt.config.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
// https://nuxt.com/docs/api/configuration/nuxt-config
22
const appName = process.env.NUXT_PUBLIC_APP_NAME ?? 'ChatGPT UI'
3-
43
export default defineNuxtConfig({
54
debug: process.env.NODE_ENV !== 'production',
6-
ssr: true,
5+
ssr: process.env.SSR !== 'false',
76
app: {
87
head: {
98
title: appName,

static.Dockerfile

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
FROM node:18-alpine3.16 as builder
2+
3+
WORKDIR /app
4+
5+
COPY package.json yarn.lock ./
6+
7+
RUN yarn install
8+
9+
COPY . .
10+
11+
RUN rm -r server && SSR=false yarn generate
12+
13+
14+
FROM nginx:1.22-alpine
15+
16+
WORKDIR /app
17+
18+
COPY --from=builder /app/.output/public .
19+
20+
COPY nginx.conf /etc/nginx/templates/default.conf.template
21+
22+
EXPOSE 80

0 commit comments

Comments
 (0)