[c+a] fix #3 and make external caddyfile

This commit is contained in:
Sangelo 2024-05-16 09:36:48 +02:00
parent 7b8e6424d9
commit 27ab7903cf
2 changed files with 28 additions and 1 deletions

26
Caddyfile Normal file
View file

@ -0,0 +1,26 @@
:80 {
root * /app
try_files {path}.html {path}
file_server
handle_errors {
# handle 4xx errors
@4xx expression `{err.status_code} >= 400 && {err.status_code} < 500`
handle @4xx {
rewrite * /internal/error/400.html
templates
file_server
}
# handle 5xx errors
@5xx expression `{err.status_code} >= 500 && {err.status_code} < 600`
handle @5xx {
rewrite * /internal/error/500.html
templates
file_server
}
}
}
:8080 {
respond /health "OK" 200
}

View file

@ -23,7 +23,8 @@ COPY --from=builder /git/build /app
RUN addgroup -S web && adduser -S web -G web && chown -R web:web /app RUN addgroup -S web && adduser -S web -G web && chown -R web:web /app
# Caddyfile configuration to serve files from /app # Caddyfile configuration to serve files from /app
RUN echo -e ":80 {\n root * /app\n try_files {path}.html {path}\n file_server\n}\n:8080 {\n respond /health \"OK\" 200\n}" > /etc/caddy/Caddyfile COPY --from=builder /git/Caddyfile /etc/caddy/Caddyfile
#RUN echo -e ":80 {\n root * /app\n try_files {path}.html {path}\n file_server\n}\n:8080 {\n respond /health \"OK\" 200\n}" > /etc/caddy/Caddyfile
# Expose port 80 # Expose port 80
EXPOSE 80 EXPOSE 80