mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-16 16:30:15 +01:00
fix(docker): handle .env file to read frontend vars during build easily (#513)
- Remove api/.env and .env from .dockerignore file - Add COPY .env .env to Dockerfile to copy .env file to docker build - Add RUN rm .env to Dockerfile to remove .env file after build - Remove build args from docker-compose.yml file
This commit is contained in:
parent
9d3e749104
commit
821b507e0e
3 changed files with 5 additions and 13 deletions
13
Dockerfile
13
Dockerfile
|
|
@ -1,22 +1,19 @@
|
|||
# Base node image
|
||||
FROM node:19-alpine AS node
|
||||
COPY . /app
|
||||
# Copy .env file
|
||||
COPY .env .env
|
||||
# Install dependencies
|
||||
WORKDIR /app
|
||||
RUN npm ci
|
||||
|
||||
# Frontend variables as build args
|
||||
ARG VITE_APP_TITLE
|
||||
ARG VITE_SHOW_GOOGLE_LOGIN_OPTION
|
||||
|
||||
# You will need to add your VITE variables to the docker-compose file
|
||||
ENV VITE_APP_TITLE=$VITE_APP_TITLE
|
||||
ENV VITE_SHOW_GOOGLE_LOGIN_OPTION=$VITE_SHOW_GOOGLE_LOGIN_OPTION
|
||||
|
||||
# React client build
|
||||
ENV NODE_OPTIONS="--max-old-space-size=2048"
|
||||
RUN npm run frontend
|
||||
|
||||
# Remove .env file after build
|
||||
RUN rm .env
|
||||
|
||||
# Node API setup
|
||||
EXPOSE 3080
|
||||
ENV HOST=0.0.0.0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue