Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 28 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,39 @@
version: '3.6'

services:
web:
build: .
app:
build:
context: .
dockerfile: Dockerfile
image: 81318131/fastapi_gpt
container_name: fastapi_gpt
command: fastapi run app/main.py --port 80
command: fastapi run app/main.py --port 8080
volumes:
- './app:/code/app'
environment:
OPENAI_API_KEY: ${KEY:-}
TEST: ${TEST:-}
ports:
- "80:80"
- "8080:8080"
networks:
- app_network

web:
build:
context: ./web
dockerfile: Dockerfile
args:
VITE_API_CLIENT_BASE_URL: "http://localhost:8080"
image: 81318131/web_gpt
container_name: web_gpt
ports:
- "80:4173"
depends_on:
- app
networks:
- app_network


networks:
app_network:
driver: bridge
17 changes: 17 additions & 0 deletions web/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM node:18-alpine AS builder
ARG VITE_API_CLIENT_BASE_URL
ENV VITE_API_CLIENT_BASE_URL=${VITE_API_CLIENT_BASE_URL}
WORKDIR /app
RUN npm install -g pnpm
COPY package.json pnpm-lock.yaml ./
RUN pnpm install
COPY . .
RUN pnpm run build

FROM nginx:stable-alpine AS production
WORKDIR /usr/share/nginx/html
RUN rm -rf ./*
COPY --from=builder /app/dist ./
COPY nginx/nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 4173
CMD ["nginx", "-g", "daemon off;"]
13 changes: 13 additions & 0 deletions web/nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
server{
listen 4173;

location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}

location /notFound {
return 404;
}
}
Loading