mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-16 16:30:15 +01:00
initial docker detup
This commit is contained in:
parent
f5e079742a
commit
ff7b016190
11 changed files with 84 additions and 14 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
|
@ -1,6 +1,7 @@
|
|||
### node etc ###
|
||||
|
||||
# Logs
|
||||
data-node
|
||||
logs
|
||||
*.log
|
||||
|
||||
|
|
@ -24,6 +25,9 @@ dist/
|
|||
public/main.js
|
||||
public/main.js.map
|
||||
public/main.js.LICENSE.txt
|
||||
client/public/main.js
|
||||
client/public/main.js.map
|
||||
client/public/main.js.LICENSE.txt
|
||||
|
||||
# Dependency directorys
|
||||
# Deployed apps should consider commenting these lines out:
|
||||
|
|
|
|||
2
api/.dockerignore
Normal file
2
api/.dockerignore
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
/node_modules
|
||||
.env
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
FROM node:latest
|
||||
FROM node:19-alpine
|
||||
WORKDIR /api
|
||||
# copy package.json into the container at /api
|
||||
COPY package*.json /api/
|
||||
|
|
|
|||
|
|
@ -16,10 +16,10 @@ const detectCode = async (text) => {
|
|||
|
||||
// console.log('qualified for code match');
|
||||
const modelOperations = new ModelOperations();
|
||||
const regexSplit = (await import('../src/utils/regexSplit.mjs')).default;
|
||||
const regexSplit = (await import('./regexSplit.mjs')).default;
|
||||
const parts = regexSplit(text, codeRegex);
|
||||
|
||||
const output = parts.map(async (part, i) => {
|
||||
const output = parts.map(async (part) => {
|
||||
if (part.match(codeRegex)) {
|
||||
const code = part.slice(3, -3);
|
||||
const language = await modelOperations.runModel(code);
|
||||
|
|
@ -37,13 +37,13 @@ const detectCode = async (text) => {
|
|||
}
|
||||
};
|
||||
|
||||
const example3 = {
|
||||
text: "By default, the function generates an 8-character password with uppercase and lowercase letters and digits, but no special characters.\n\nTo use this function, simply call it with the desired arguments. For example:\n\n```\n>>> generate_password()\n'wE5pUxV7'\n>>> generate_password(length=12, special_chars=True)\n'M4v&^gJ*8#qH'\n>>> generate_password(uppercase=False, digits=False)\n'zajyprxr'\n``` \n\nNote that the randomness is used to select characters from the available character sets, but the resulting password is always deterministic given the same inputs. This makes the function useful for generating secure passwords that meet specific requirements."
|
||||
};
|
||||
// const example3 = {
|
||||
// text: "By default, the function generates an 8-character password with uppercase and lowercase letters and digits, but no special characters.\n\nTo use this function, simply call it with the desired arguments. For example:\n\n```\n>>> generate_password()\n'wE5pUxV7'\n>>> generate_password(length=12, special_chars=True)\n'M4v&^gJ*8#qH'\n>>> generate_password(uppercase=False, digits=False)\n'zajyprxr'\n``` \n\nNote that the randomness is used to select characters from the available character sets, but the resulting password is always deterministic given the same inputs. This makes the function useful for generating secure passwords that meet specific requirements."
|
||||
// };
|
||||
|
||||
const example4 = {
|
||||
text: 'here\'s a cool function:\n```\nimport random\nimport string\n\ndef generate_password(length=8, uppercase=True, lowercase=True, digits=True, special_chars=False):\n """Generate a random password with specified requirements.\n\n Args:\n length (int): The length of the password. Default is 8.\n uppercase (bool): Whether to include uppercase letters. Default is True.\n lowercase (bool): Whether to include lowercase letters. Default is True.\n digits (bool): Whether to include digits. Default is True.\n special_chars (bool): Whether to include special characters. Default is False.\n\n Returns:\n str: A random password with the specified requirements.\n """\n # Define character sets to use in password generation\n chars = ""\n if uppercase:\n chars += string.ascii_uppercase\n if lowercase:\n chars += string.ascii_lowercase\n if digits:\n chars += string.digits\n if special_chars:\n chars += string.punctuation\n\n # Generate the password\n password = "".join(random.choice(chars) for _ in range(length))\n return password\n```\n\nThis function takes several arguments'
|
||||
};
|
||||
// const example4 = {
|
||||
// text: 'here\'s a cool function:\n```\nimport random\nimport string\n\ndef generate_password(length=8, uppercase=True, lowercase=True, digits=True, special_chars=False):\n """Generate a random password with specified requirements.\n\n Args:\n length (int): The length of the password. Default is 8.\n uppercase (bool): Whether to include uppercase letters. Default is True.\n lowercase (bool): Whether to include lowercase letters. Default is True.\n digits (bool): Whether to include digits. Default is True.\n special_chars (bool): Whether to include special characters. Default is False.\n\n Returns:\n str: A random password with the specified requirements.\n """\n # Define character sets to use in password generation\n chars = ""\n if uppercase:\n chars += string.ascii_uppercase\n if lowercase:\n chars += string.ascii_lowercase\n if digits:\n chars += string.digits\n if special_chars:\n chars += string.punctuation\n\n # Generate the password\n password = "".join(random.choice(chars) for _ in range(length))\n return password\n```\n\nThis function takes several arguments'
|
||||
// };
|
||||
|
||||
// write an immediately invoked function to test this
|
||||
// (async () => {
|
||||
|
|
|
|||
2
client/.dockerignore
Normal file
2
client/.dockerignore
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
/node_modules
|
||||
.env
|
||||
18
client/Dockerfile
Normal file
18
client/Dockerfile
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
# Stage 1
|
||||
FROM node:19-alpine as builder
|
||||
WORKDIR /client
|
||||
# copy package.json into the container at /client
|
||||
COPY package*.json /client/
|
||||
# install dependencies
|
||||
RUN npm install
|
||||
# Copy the current directory contents into the container at /client
|
||||
COPY . /client/
|
||||
# Run the app when the container launches
|
||||
CMD ["npm", "run", "build"]
|
||||
|
||||
# Stage 2
|
||||
FROM nginx:stable-alpine
|
||||
WORKDIR /usr/share/nginx/html
|
||||
RUN rm -rf ./*
|
||||
COPY --from=builder /client/public /usr/share/nginx/html
|
||||
ENTRYPOINT ["nginx", "-g", "daemon off;"]
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"build": "Webpack .",
|
||||
"build": "webpack",
|
||||
"build-dev": "Webpack . --watch"
|
||||
},
|
||||
"repository": {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import React from 'react';
|
|||
import RenameIcon from '../svg/RenameIcon';
|
||||
import CheckMark from '../svg/CheckMark';
|
||||
|
||||
export default function RenameButton({ onClick, renaming, renameHandler, onRename }) {
|
||||
export default function RenameButton({ renaming, renameHandler, onRename }) {
|
||||
const handler = renaming ? onRename : renameHandler;
|
||||
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ const initialState = {
|
|||
promptPrefix: null,
|
||||
convosLoading: false,
|
||||
pageNumber: 1,
|
||||
convos: [],
|
||||
convos: []
|
||||
};
|
||||
|
||||
const currentSlice = createSlice({
|
||||
|
|
@ -32,8 +32,10 @@ const currentSlice = createSlice({
|
|||
const newConvos = action.payload.filter((convo) => {
|
||||
return !state.convos.some((c) => c.conversationId === convo.conversationId);
|
||||
});
|
||||
state.convos = [...state.convos, ...newConvos];
|
||||
},
|
||||
state.convos = [...state.convos, ...newConvos].sort(
|
||||
(a, b) => new Date(b.created) - new Date(a.created)
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
42
docker-compose.yml
Normal file
42
docker-compose.yml
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
version: "2"
|
||||
|
||||
services:
|
||||
client:
|
||||
image: react-app
|
||||
restart: always
|
||||
ports:
|
||||
- "3000:3000"
|
||||
volumes:
|
||||
- ./client:/client
|
||||
- /client/node_modules
|
||||
links:
|
||||
- api
|
||||
networks:
|
||||
- webappnetwork
|
||||
api:
|
||||
image: node-api
|
||||
restart: always
|
||||
ports:
|
||||
- "9000:9000"
|
||||
volumes:
|
||||
- ./api:/api
|
||||
- /api/node_modules
|
||||
depends_on:
|
||||
- mongodb
|
||||
networks:
|
||||
- webappnetwork
|
||||
mongodb:
|
||||
image: mongo
|
||||
restart: always
|
||||
container_name: mongodb
|
||||
volumes:
|
||||
- ./data-node:/data/db
|
||||
ports:
|
||||
- 27017:27017
|
||||
command: mongod --noauth
|
||||
networks:
|
||||
- webappnetwork
|
||||
|
||||
networks:
|
||||
webappnetwork:
|
||||
driver: bridge
|
||||
Loading…
Add table
Add a link
Reference in a new issue