Nginx instead of dev server

This commit is contained in:
Andrey 2023-05-06 17:46:40 +03:00
parent b025e444c5
commit c2fd747f33
5 changed files with 63 additions and 6 deletions

View file

@ -4,7 +4,7 @@ from pydantic import BaseSettings
class Config(BaseSettings): class Config(BaseSettings):
host: str = '127.0.0.1' host: str = '127.0.0.1'
port: int = 8888 port: int = 80
birthdate: date = date(2007, 10, 13) birthdate: date = date(2007, 10, 13)

View file

@ -9,6 +9,7 @@ services:
environment: environment:
- BIRTHDATE=2007-10-13 - BIRTHDATE=2007-10-13
- HOST=0.0.0.0 - HOST=0.0.0.0
# - PORT=80 # default port
frontend: frontend:
image: git.mootfrost.dev/mootfrost777/mootfrost-dev_frontend:latest image: git.mootfrost.dev/mootfrost777/mootfrost-dev_frontend:latest
container_name: mootfrost-dev_frontend container_name: mootfrost-dev_frontend
@ -21,4 +22,4 @@ services:
- traefik.http.routers.mootfrost_dev.rule=Host(`mootfrost.dev`) - traefik.http.routers.mootfrost_dev.rule=Host(`mootfrost.dev`)
# Website port # Website port
ports: ports:
- "7632:3000" - "7632:80"

View file

@ -1,3 +1,2 @@
VITE_BACKEND=http://backend:8888 VITE_BACKEND=http://backend
VITE
VITE_PORT=3000 VITE_PORT=3000

View file

@ -1,10 +1,19 @@
FROM node:20-alpine FROM node:20-alpine AS builder
WORKDIR /app WORKDIR /app
COPY package*.json ./ COPY package*.json ./
RUN yarn RUN yarn
COPY . . COPY . .
CMD ["yarn", "dev", "--port", "3000", "--host", "0.0.0.0"] RUN yarn build
FROM nginx:stable-alpine
COPY --from=builder /app/dist /usr/share/nginx/html
RUN rm /etc/nginx/conf.d/default.conf
COPY /nginx/default.conf /etc/nginx/conf.d
CMD ["nginx", "-g", "daemon off;"]

View file

@ -0,0 +1,48 @@
server {
listen 80;
listen [::]:80;
server_name localhost;
#access_log /var/log/nginx/host.access.log main;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
location /api {
proxy_pass http://backend;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}