add dockerfile

This commit is contained in:
john 2025-05-18 01:30:54 +02:00
parent dcaccc7ab8
commit abd7c2f073
4 changed files with 33 additions and 1 deletions

25
Dockerfile Normal file
View file

@ -0,0 +1,25 @@
# Stage 1: Build the Vite React app
FROM node:22-alpine AS builder
WORKDIR /app
# Install dependencies
COPY package.json /app
COPY yarn.lock /app
RUN yarn install
COPY . .
RUN yarn build
# Stage 2: Serve with Caddy
FROM caddy:alpine
# Copy built app to the web root
COPY --from=builder /app/dist /usr/share/caddy
# Add Caddyfile (for routing support)
COPY Caddyfile /etc/caddy/Caddyfile
EXPOSE 80
CMD ["caddy", "run", "--config", "/etc/caddy/Caddyfile", "--adapter", "caddyfile"]