mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-12-18 10:31:30 +03:00
feat: api routing in docker image
This commit is contained in:
parent
eab0d6dc6e
commit
e435dbd2cb
39
.github/deployment/Caddyfile
vendored
Normal file
39
.github/deployment/Caddyfile
vendored
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
:80 {
|
||||||
|
root /* ./dist
|
||||||
|
|
||||||
|
file_server {
|
||||||
|
# precompressed br
|
||||||
|
}
|
||||||
|
|
||||||
|
encode {
|
||||||
|
zstd
|
||||||
|
gzip 9
|
||||||
|
}
|
||||||
|
|
||||||
|
header {
|
||||||
|
# 7 days
|
||||||
|
Cache-Control "public, max-age=86400, must-revalidate"
|
||||||
|
}
|
||||||
|
|
||||||
|
handle_path /api/* {
|
||||||
|
reverse_proxy {$API_SERVER} {
|
||||||
|
@error status 500 502 503 503
|
||||||
|
handle_response @error {
|
||||||
|
root * /dist
|
||||||
|
rewrite * /50x.html
|
||||||
|
file_server
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@notStatic {
|
||||||
|
not path /_next/static/*
|
||||||
|
}
|
||||||
|
|
||||||
|
handle @notStatic {
|
||||||
|
header {
|
||||||
|
Cache-Control "no-cache, no-store, must-revalidate"
|
||||||
|
}
|
||||||
|
try_files {path} /index.html
|
||||||
|
}
|
||||||
|
}
|
14
.github/deployment/Dockerfile
vendored
14
.github/deployment/Dockerfile
vendored
@ -1,5 +1,13 @@
|
|||||||
FROM nginx:alpine
|
FROM node:16-alpine as relocate
|
||||||
|
WORKDIR /app
|
||||||
|
COPY ./packages/app/out ./dist
|
||||||
|
COPY ./.github/deployment/Caddyfile ./Caddyfile
|
||||||
|
|
||||||
COPY ./packages/app/out /usr/share/nginx/html
|
FROM caddy:2.6.2-alpine
|
||||||
|
ARG API_SERVER
|
||||||
|
WORKDIR /app
|
||||||
|
COPY --from=relocate /app .
|
||||||
|
|
||||||
COPY ./.github/deployment/nginx.conf /etc/nginx/conf.d/default.conf
|
EXPOSE 80
|
||||||
|
ENV API_SERVER=$API_SERVER
|
||||||
|
CMD ["caddy", "run"]
|
29
.github/deployment/nginx.conf
vendored
29
.github/deployment/nginx.conf
vendored
@ -1,29 +0,0 @@
|
|||||||
server {
|
|
||||||
listen 80;
|
|
||||||
listen [::]:80;
|
|
||||||
server_name localhost;
|
|
||||||
|
|
||||||
#access_log /var/log/nginx/host.access.log main;
|
|
||||||
|
|
||||||
root /usr/share/nginx/html;
|
|
||||||
index index.html index.htm;
|
|
||||||
|
|
||||||
location /_next/static {
|
|
||||||
# 7 days
|
|
||||||
add_header Cache-Control "max-age=86400";
|
|
||||||
}
|
|
||||||
|
|
||||||
location / {
|
|
||||||
try_files $uri $uri.html /$uri /index.html
|
|
||||||
add_header Cache-Control "no-cache";
|
|
||||||
}
|
|
||||||
|
|
||||||
#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;
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user