update
This commit is contained in:
8
web/Caddyfile
Normal file
8
web/Caddyfile
Normal file
@@ -0,0 +1,8 @@
|
||||
:80 {
|
||||
root * /srv/web_build
|
||||
try_files {path} /200.html
|
||||
file_server
|
||||
|
||||
@health path /health
|
||||
respond @health "ok" 200
|
||||
}
|
||||
26
web/Dockerfile
Normal file
26
web/Dockerfile
Normal file
@@ -0,0 +1,26 @@
|
||||
# Builder: build the SvelteKit static site (adapter-static -> /app/build)
|
||||
FROM node:20-alpine AS builder
|
||||
WORKDIR /app
|
||||
|
||||
# cache package install
|
||||
COPY package.json package-lock.json* ./
|
||||
RUN npm ci --production=false
|
||||
|
||||
# copy source and build
|
||||
COPY . .
|
||||
RUN npm run build
|
||||
|
||||
# Final: lightweight Caddy image to serve the built static files
|
||||
FROM caddy:2-alpine AS runtime
|
||||
# copy built static output
|
||||
COPY --from=builder /app/build /srv/web_build
|
||||
# copy Caddyfile from build context (provide Caddyfile at ./web/Caddyfile)
|
||||
COPY Caddyfile /etc/caddy/Caddyfile
|
||||
# # ensure permissions (caddy runs as non-root)
|
||||
# RUN chown -R caddy:caddy /srv/web_build /etc/caddy/Caddyfile
|
||||
CMD ["caddy", "run", "--config", "/etc/caddy/Caddyfile"]
|
||||
|
||||
# expose standard HTTP/HTTPS (optional in compose)
|
||||
EXPOSE 80
|
||||
|
||||
# container runs Caddy by default (CMD provided by base image)
|
||||
@@ -1,6 +1,12 @@
|
||||
import adapter from '@sveltejs/adapter-static';
|
||||
|
||||
/** @type {import('@sveltejs/kit').Config} */
|
||||
const config = { kit: { adapter: adapter() } };
|
||||
|
||||
const config = {
|
||||
kit: {
|
||||
adapter: adapter({
|
||||
pages: 'build',
|
||||
assets: 'build',
|
||||
fallback: '200.html' // SPA fallback for all unknown paths
|
||||
})
|
||||
}
|
||||
};
|
||||
export default config;
|
||||
|
||||
Reference in New Issue
Block a user