webui/Dockerfile

28 lines
754 B
Docker

# Stage 1 - Build Vite app
FROM node:latest as build-deps
WORKDIR /app
COPY . .
RUN npm install
RUN npm run build
RUN npm run build-css
# Stage 2 - Production environment (Nginx)
FROM nginx:latest
# Copy Nginx config
COPY nginx/nginx.conf /etc/nginx/conf.d/default.conf
# Copy built Vite output
COPY --from=build-deps /app/dist /usr/share/nginx/html
# Create env.js at container startup
# This injects runtime environment variables into window._env_
CMD ["/bin/sh", "-c", "\
echo \"window._env_ = { \
API_URL: '${API_URL}', \
EXTERNAL_LOGIN: true, \
CKEDITOR_LICENSE_KEY: '${CKEDITOR_LICENSE_KEY}', \
STICKER_TEXT: '${STICKER_TEXT}' \
};\" > /usr/share/nginx/html/env.js && \
nginx -g 'daemon off;'"]