describe Caddyfile & update Dockerfile runtime image

This commit is contained in:
2026-02-24 00:20:49 +01:00
parent 8e586811ec
commit 50e3206b56
2 changed files with 39 additions and 13 deletions

31
Caddyfile Normal file
View File

@@ -0,0 +1,31 @@
{
# Disable automatic HTTPS
auto_https off
}
:8080 {
root * {$DIST_PATH:/usr/share/caddy}
file_server
encode gzip zstd
try_files {path} {path}/ /index.html
# Cache favicons aggressively
@favicons path /favicons/*
header @favicons Cache-Control "public, max-age=31536000, immutable"
# Cache static assets based on MIME type
@static {
header Content-Type application/javascript*
header Content-Type text/css*
header Content-Type image/*
header Content-Type font/*
header Content-Type application/font-*
header Content-Type application/woff*
header Content-Type application/json*
}
header @static Cache-Control "public, max-age=2592000, immutable"
}

View File

@@ -23,21 +23,16 @@ ENV VITE_ELASTIC_API_KEY=$ELASTIC_API_KEY
RUN yarn build RUN yarn build
FROM nginx:1.29.5 FROM caddy:2.11-alpine
COPY Caddyfile /etc/caddy/Caddyfile
# Copy static files
COPY public /usr/share/caddy
# Copy the static build from the previous stage # Copy the static build from the previous stage
COPY index.html /usr/share/nginx/html COPY --from=build /app/dist /usr/share/caddy
COPY public/ /usr/share/nginx/html
COPY --from=build /app/dist /usr/share/nginx/html
# Copy nginx config file EXPOSE 8080
COPY nginx.conf /etc/nginx/conf.d/default.conf.template
# Manual entrypoint after nginx substring
COPY docker-entrypoint.sh /docker-entrypoint.d/05-docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.d/05-docker-entrypoint.sh
EXPOSE 5000
LABEL org.opencontainers.image.source https://github.com/kevinmidboe/seasoned LABEL org.opencontainers.image.source https://github.com/kevinmidboe/seasoned