mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 00:40:14 +01:00
Move Dockerfiles into one toplevel Dockerfile
This commit is contained in:
parent
1041146fcb
commit
c233cc0d5c
5 changed files with 56 additions and 66 deletions
2
.dockerignore
Normal file
2
.dockerignore
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
**/node_modules
|
||||||
|
**/.env
|
||||||
27
Dockerfile
Normal file
27
Dockerfile
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
FROM node:19-alpine AS react-client
|
||||||
|
WORKDIR /client
|
||||||
|
# copy package.json into the container at /client
|
||||||
|
COPY /client/package*.json /client/
|
||||||
|
# install dependencies
|
||||||
|
RUN npm ci
|
||||||
|
# Copy the current directory contents into the container at /client
|
||||||
|
COPY /client/ /client/
|
||||||
|
# Build webpack artifacts
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
FROM node:19-alpine AS node-api
|
||||||
|
WORKDIR /api
|
||||||
|
# copy package.json into the container at /api
|
||||||
|
COPY /api/package*.json /api/
|
||||||
|
# install dependencies
|
||||||
|
RUN npm ci
|
||||||
|
# Copy the current directory contents into the container at /api
|
||||||
|
COPY /api/ /api/
|
||||||
|
# Copy the client side code
|
||||||
|
COPY --from=react-client /client/public /client/public
|
||||||
|
# Make port 3080 available to the world outside this container
|
||||||
|
EXPOSE 3080
|
||||||
|
# Expose the server to 0.0.0.0
|
||||||
|
ENV HOST=0.0.0.0
|
||||||
|
# Run the app when the container launches
|
||||||
|
CMD ["npm", "start"]
|
||||||
|
|
@ -1,2 +0,0 @@
|
||||||
/node_modules
|
|
||||||
.env
|
|
||||||
|
|
@ -1,16 +0,0 @@
|
||||||
FROM node:19-alpine
|
|
||||||
WORKDIR /api
|
|
||||||
# copy package.json into the container at /api
|
|
||||||
COPY package*.json /api/
|
|
||||||
# install dependencies
|
|
||||||
RUN npm ci
|
|
||||||
# Copy the current directory contents into the container at /api
|
|
||||||
COPY . /api/
|
|
||||||
# Make port 3080 available to the world outside this container
|
|
||||||
EXPOSE 3080
|
|
||||||
# Expose the server to 0.0.0.0
|
|
||||||
ENV HOST=0.0.0.0
|
|
||||||
# Run the app when the container launches
|
|
||||||
CMD ["npm", "start"]
|
|
||||||
|
|
||||||
# docker build -t node-api .
|
|
||||||
|
|
@ -1,50 +1,29 @@
|
||||||
version: "2"
|
version: "3.4"
|
||||||
|
|
||||||
services:
|
services:
|
||||||
client:
|
api:
|
||||||
image: react-client
|
ports:
|
||||||
build: ./client
|
- 3080:3080
|
||||||
restart: always
|
depends_on:
|
||||||
ports:
|
- mongodb
|
||||||
- "3080:80"
|
image: node-api
|
||||||
volumes:
|
build:
|
||||||
- ./client:/client
|
context: .
|
||||||
- /client/node_modules
|
target: node-api
|
||||||
links:
|
restart: always
|
||||||
- api
|
env_file:
|
||||||
networks:
|
- ./api/.env
|
||||||
- webappnetwork
|
environment:
|
||||||
api:
|
- HOST=0.0.0.0
|
||||||
image: node-api
|
- NODE_ENV=production
|
||||||
build: ./api
|
- MONGO_URI=mongodb://mongodb:27017/chatgpt-clone
|
||||||
restart: always
|
volumes:
|
||||||
env_file:
|
- ./api:/api
|
||||||
- ./api/.env
|
- /api/node_modules
|
||||||
environment:
|
mongodb:
|
||||||
- HOST=0.0.0.0
|
image: mongo
|
||||||
- NODE_ENV=production
|
restart: always
|
||||||
- MONGO_URI=mongodb://mongodb:27017/chatgpt-clone
|
container_name: mongodb
|
||||||
ports:
|
volumes:
|
||||||
- "9000:3080"
|
- ./data-node:/data/db
|
||||||
volumes:
|
command: mongod --noauth
|
||||||
- ./api:/api
|
|
||||||
- /api/node_modules
|
|
||||||
depends_on:
|
|
||||||
- mongodb
|
|
||||||
networks:
|
|
||||||
- webappnetwork
|
|
||||||
mongodb:
|
|
||||||
image: mongo
|
|
||||||
restart: always
|
|
||||||
container_name: mongodb
|
|
||||||
volumes:
|
|
||||||
- ./data-node:/data/db
|
|
||||||
ports:
|
|
||||||
- 27020:27017
|
|
||||||
command: mongod --noauth
|
|
||||||
networks:
|
|
||||||
- webappnetwork
|
|
||||||
|
|
||||||
networks:
|
|
||||||
webappnetwork:
|
|
||||||
driver: bridge
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue