-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
42 lines (25 loc) · 1021 Bytes
/
Dockerfile
File metadata and controls
42 lines (25 loc) · 1021 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
FROM node:22-alpine AS build-stage
LABEL maintainer="Pranjal.Rai"
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
ENV NODE_ENV=production
RUN npm run build
FROM nginx:stable-alpine
WORKDIR /app
RUN chown nginx:nginx /app && apk add --no-cache gettext
ARG BACKEND
ARG CHAT_API
ENV VITE_BACKEND_BASE_URL=$BACKEND
ENV VITE_CHAT_API_URL=$CHAT_API
ENV PORT=4173
# Copy the React build files into Nginx's public directory
COPY --from=build-stage /app/dist /usr/share/nginx/html
COPY nginx/nginx.conf /etc/nginx/
COPY nginx/pecha.conf.template /etc/nginx/conf.d/
COPY nginx/security-headers.conf /etc/nginx/
EXPOSE 4173
CMD ["sh", "-c", "envsubst '${VITE_BACKEND_BASE_URL} ${VITE_CHAT_API_URL}' < /etc/nginx/conf.d/pecha.conf.template > /etc/nginx/conf.d/default.conf && cat /etc/nginx/conf.d/default.conf && nginx -g 'daemon off;'"]
# docker build -f Dockerfile -t pecha-ui-app .
# docker run -e VITE_BACKEND_BASE_URL=<backend-url> -e VITE_CHAT_API_URL=<chat-api-url> -p 4173:4173 --rm pecha-ui-app