build utils

This commit is contained in:
2024-04-12 22:44:02 +03:00
parent 8df8f5a2e9
commit f6d316cb5e
7 changed files with 68 additions and 4 deletions

View File

@ -1 +1,42 @@
services:
backend:
build:
context: backend
restart: unless-stopped
ports:
- "8000"
env_file:
- path: ./env/backend/prod.env
required: true
volumes:
- ./backend/app:/code/app:z
depends_on:
postgres:
condition: service_healthy
nginx:
build:
dockerfile: ./nginx/Dockerfile
restart: unless-stopped
volumes:
- ./nginx/nginx.conf:/etc/nginx/conf.d/default.conf:ro
- ./static:/static
depends_on:
- backend
ports:
- "80:80"
postgres:
image: postgres:16.2-alpine
restart: unless-stopped
ports:
- "5432:5432"
volumes:
- ./postgres_data:/var/lib/postgresql/data/
env_file:
- path: ./env/postgres.env
required: true
healthcheck:
test:
["CMD-SHELL", "pg_isready -d $${POSTGRES_DB} --user $${POSTGRES_USER}"]
interval: 2s
timeout: 2s
retries: 5

View File

@ -0,0 +1,3 @@
POSTGRES_USER=user
POSTGRES_PASSWORD=password
POSTGRES_DB=db

View File

@ -0,0 +1,5 @@
CI=true
PORT=3000
HOST=0.0.0.0
WDS_SOCKET_PORT=0
REACT_APP_DOMAIN=127.0.0.1

View File

@ -64,5 +64,8 @@
}, },
"Dashboard": { "Dashboard": {
"ru": "Панель управления" "ru": "Панель управления"
},
"Page not found": {
"ru": "Страница не найдена"
} }
} }

View File

@ -9,7 +9,8 @@ const NotFoundPage = () => {
<div style={{ width: "100%", marginTop: "3rem" }}> <div style={{ width: "100%", marginTop: "3rem" }}>
<QuestionCircleOutlined style={{ fontSize: "5rem" }} /> <QuestionCircleOutlined style={{ fontSize: "5rem" }} />
</div> </div>
<Title>{tr("Not found")}</Title> <Title>{tr("Page not found")}</Title>
<Title level={3}>404</Title>
</> </>
); );
}; };

11
nginx/Dockerfile Normal file
View File

@ -0,0 +1,11 @@
FROM node:21-alpine as build
WORKDIR /app
ENV PATH /app/node_modules/.bin:$PATH
COPY ./frontend/app .
RUN npm ci
RUN npm run build
FROM nginx:1.25.4-alpine
COPY --from=build /app/dist /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]

View File

@ -1,6 +1,6 @@
server { server {
listen 80; listen 80;
server_name 192.168.1.121; server_name queueful.ollyhearn.ru;
location / { location / {
proxy_hide_header 'Access-Control-Allow-Origin'; proxy_hide_header 'Access-Control-Allow-Origin';
add_header 'Access-Control-Allow-Origin' '*' always; add_header 'Access-Control-Allow-Origin' '*' always;
@ -25,7 +25,7 @@ server {
proxy_hide_header 'Access-Control-Allow-Methods'; proxy_hide_header 'Access-Control-Allow-Methods';
add_header 'Access-Control-Allow-Methods' '*' always; add_header 'Access-Control-Allow-Methods' '*' always;
proxy_pass http://api:8000/api/; proxy_pass http://backend:8000;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;