fix: deploy

This commit is contained in:
Kilu 2024-06-29 00:42:32 +08:00
parent 30e24294cb
commit 9ab1ed8ccb
3 changed files with 19 additions and 101 deletions

View File

@ -71,4 +71,4 @@ jobs:
cd appflowy-web-app cd appflowy-web-app
docker build -t appflowy-web-app . docker build -t appflowy-web-app .
docker rm -f appflowy-web-app || true docker rm -f appflowy-web-app || true
docker run -d -p 3000:3000 --env-file .env -v /var/www/html/appflowy-web-app:/usr/share/nginx/html --name appflowy-web-app appflowy-web-app docker run -d -p 3000:3000 --env-file .env --name appflowy-web-app appflowy-web-app

View File

@ -9,12 +9,18 @@ RUN bun install cheerio pino pino-pretty
COPY . . COPY . .
RUN addgroup --system nginx && \
adduser --system --no-create-home --disabled-login --ingroup nginx nginx
RUN apt-get clean && rm -rf /var/lib/apt/lists/* RUN apt-get clean && rm -rf /var/lib/apt/lists/*
COPY dist/ /usr/share/nginx/html/ COPY dist/ /usr/share/nginx/html/
COPY nginx.conf /etc/nginx/nginx.conf
RUN chown -R nginx:nginx /etc/ssl/certs/nginx-signed.crt /etc/ssl/private/nginx-signed.key
COPY start.sh /app/start.sh COPY start.sh /app/start.sh
RUN chmod +x /app/start.sh RUN chmod +x /app/start.sh

View File

@ -1,102 +1,14 @@
# nginx.conf server {
user nginx; listen 3000;
worker_processes auto; server_name localhost;
error_log /var/log/nginx/error.log notice; location /static/ {
pid /var/run/nginx.pid; root /usr/share/nginx/html;
try_files $uri =404;
}
events { location /appflowy.svg {
worker_connections 1024; root /usr/share/nginx/html;
} try_files $uri =404;
}
http { }
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
gzip on;
gzip_static on;
gzip_http_version 1.0;
gzip_comp_level 5;
gzip_vary on;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript application/wasm;
# Existing server block for HTTP
server {
listen 3000;
server_name localhost;
#server_name appflowy.com *.appflowy.com;
location / {
return 301 https://$host$request_uri;
}
}
# Additional server block for HTTPS
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name localhost;
#server_name appflowy.com *.appflowy.com;
ssl_certificate /etc/ssl/certs/nginx-signed.crt;
ssl_certificate_key /etc/ssl/private/nginx-signed.key;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
location / {
proxy_pass http://localhost:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
location /static/ {
root /usr/share/nginx/html;
expires 30d;
access_log off;
location ~* \.wasm$ {
types { application/wasm wasm; }
default_type application/wasm;
}
}
location /appflowy.svg {
root /usr/share/nginx/html;
expires 30d;
access_log off;
}
error_page 404 /404.html;
location = /404.html {
root /usr/share/nginx/html;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
}