mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-16 16:30:15 +01:00
Provide nginx docker build recipe
This commit is contained in:
parent
36f3d37ecc
commit
40ed6fa9ec
3 changed files with 37 additions and 1 deletions
|
|
@ -25,3 +25,11 @@ EXPOSE 3080
|
||||||
ENV HOST=0.0.0.0
|
ENV HOST=0.0.0.0
|
||||||
# Run the app when the container launches
|
# Run the app when the container launches
|
||||||
CMD ["npm", "start"]
|
CMD ["npm", "start"]
|
||||||
|
|
||||||
|
# Optional: for client with nginx routing
|
||||||
|
FROM nginx:stable-alpine AS nginx-client
|
||||||
|
WORKDIR /usr/share/nginx/html
|
||||||
|
COPY --from=react-client /client/public /usr/share/nginx/html
|
||||||
|
# Add your nginx.conf
|
||||||
|
COPY /client/nginx.conf /etc/nginx/conf.d/default.conf
|
||||||
|
ENTRYPOINT ["nginx", "-g", "daemon off;"]
|
||||||
|
|
|
||||||
15
client/nginx.conf
Normal file
15
client/nginx.conf
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name localhost;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
# Serve your React app
|
||||||
|
root /usr/share/nginx/html;
|
||||||
|
index index.html;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /api {
|
||||||
|
# Proxy requests to the API service
|
||||||
|
proxy_pass http://api:3080/api;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,9 +1,21 @@
|
||||||
version: "3.4"
|
version: "3.4"
|
||||||
|
|
||||||
services:
|
services:
|
||||||
|
# client:
|
||||||
|
# image: react-client
|
||||||
|
# build:
|
||||||
|
# context: .
|
||||||
|
# target: nginx-client
|
||||||
|
# restart: always
|
||||||
|
# ports:
|
||||||
|
# - 3080:80
|
||||||
|
# volumes:
|
||||||
|
# - /client/node_modules
|
||||||
|
# depends_on:
|
||||||
|
# - api
|
||||||
api:
|
api:
|
||||||
ports:
|
ports:
|
||||||
- 3080:3080
|
- 3080:3080 # Change it to 9000:3080 if you want to use nginx
|
||||||
depends_on:
|
depends_on:
|
||||||
- mongodb
|
- mongodb
|
||||||
image: node-api
|
image: node-api
|
||||||
|
|
@ -18,6 +30,7 @@ services:
|
||||||
- NODE_ENV=production
|
- NODE_ENV=production
|
||||||
- MONGO_URI=mongodb://mongodb:27017/chatgpt-clone
|
- MONGO_URI=mongodb://mongodb:27017/chatgpt-clone
|
||||||
volumes:
|
volumes:
|
||||||
|
- /client/node_modules
|
||||||
- ./api:/api
|
- ./api:/api
|
||||||
- /api/node_modules
|
- /api/node_modules
|
||||||
mongodb:
|
mongodb:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue