Spaces:
Sleeping
Sleeping
fix
Browse files- Dockerfile +11 -4
- devops/nginx.default.conf +4 -17
Dockerfile
CHANGED
|
@@ -1,14 +1,10 @@
|
|
| 1 |
# Build
|
| 2 |
FROM node:20-alpine AS builder
|
| 3 |
WORKDIR /app
|
| 4 |
-
|
| 5 |
COPY package.json ./
|
| 6 |
COPY package-lock.json* ./
|
| 7 |
-
|
| 8 |
RUN npm ci
|
| 9 |
-
|
| 10 |
COPY . .
|
| 11 |
-
|
| 12 |
ARG VITE_API_BASE_URL=https://muryshev-generic-chatbot-backend.hf.space
|
| 13 |
ENV VITE_API_BASE_URL=$VITE_API_BASE_URL
|
| 14 |
RUN npm run build
|
|
@@ -17,9 +13,20 @@ RUN npm run build
|
|
| 17 |
FROM nginx:alpine
|
| 18 |
WORKDIR /usr/share/nginx/html
|
| 19 |
|
|
|
|
| 20 |
COPY --from=builder /app/dist .
|
|
|
|
|
|
|
| 21 |
COPY devops/nginx.default.conf /etc/nginx/conf.d/default.conf
|
| 22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
ENV PORT=7860
|
| 24 |
EXPOSE ${PORT}
|
|
|
|
|
|
|
| 25 |
CMD ["nginx", "-g", "daemon off;"]
|
|
|
|
| 1 |
# Build
|
| 2 |
FROM node:20-alpine AS builder
|
| 3 |
WORKDIR /app
|
|
|
|
| 4 |
COPY package.json ./
|
| 5 |
COPY package-lock.json* ./
|
|
|
|
| 6 |
RUN npm ci
|
|
|
|
| 7 |
COPY . .
|
|
|
|
| 8 |
ARG VITE_API_BASE_URL=https://muryshev-generic-chatbot-backend.hf.space
|
| 9 |
ENV VITE_API_BASE_URL=$VITE_API_BASE_URL
|
| 10 |
RUN npm run build
|
|
|
|
| 13 |
FROM nginx:alpine
|
| 14 |
WORKDIR /usr/share/nginx/html
|
| 15 |
|
| 16 |
+
# Копируем собранные файлы фронтенда
|
| 17 |
COPY --from=builder /app/dist .
|
| 18 |
+
|
| 19 |
+
# Копируем конфигурацию Nginx
|
| 20 |
COPY devops/nginx.default.conf /etc/nginx/conf.d/default.conf
|
| 21 |
|
| 22 |
+
# Создаём рабочие директории для Nginx и задаём права
|
| 23 |
+
RUN mkdir -p /var/cache/nginx /var/run/nginx /var/log/nginx \
|
| 24 |
+
&& chmod -R 755 /var/cache/nginx /var/run/nginx /var/log/nginx \
|
| 25 |
+
&& chown -R nginx:nginx /var/cache/nginx /var/run/nginx /var/log/nginx
|
| 26 |
+
|
| 27 |
+
# Указываем порт 7860
|
| 28 |
ENV PORT=7860
|
| 29 |
EXPOSE ${PORT}
|
| 30 |
+
|
| 31 |
+
# Запускаем Nginx в foreground
|
| 32 |
CMD ["nginx", "-g", "daemon off;"]
|
devops/nginx.default.conf
CHANGED
|
@@ -1,23 +1,10 @@
|
|
| 1 |
server {
|
| 2 |
-
listen
|
| 3 |
-
server_name
|
| 4 |
-
|
| 5 |
-
root /usr/share/nginx/html;
|
| 6 |
-
index index.html;
|
| 7 |
|
| 8 |
location / {
|
|
|
|
|
|
|
| 9 |
try_files $uri $uri/ /index.html;
|
| 10 |
}
|
| 11 |
-
|
| 12 |
-
location = /favicon.ico {
|
| 13 |
-
log_not_found off;
|
| 14 |
-
access_log off;
|
| 15 |
-
}
|
| 16 |
-
|
| 17 |
-
location = /robots.txt {
|
| 18 |
-
log_not_found off;
|
| 19 |
-
access_log off;
|
| 20 |
-
}
|
| 21 |
-
|
| 22 |
-
error_page 404 /index.html;
|
| 23 |
}
|
|
|
|
| 1 |
server {
|
| 2 |
+
listen 7860;
|
| 3 |
+
server_name localhost;
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
location / {
|
| 6 |
+
root /usr/share/nginx/html;
|
| 7 |
+
index index.html;
|
| 8 |
try_files $uri $uri/ /index.html;
|
| 9 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
}
|