photum/frontend/Dockerfile
Tiago Yamamoto c7ba7586b8
Some checks are pending
K3s Auto-Deploy / build-and-deploy (push) Waiting to run
feat: add Dockerfile for frontend deployment
2026-03-07 12:02:03 -06:00

32 lines
650 B
Docker

# Build stage
FROM node:20-alpine AS builder
WORKDIR /app
# Copy package files and install dependencies
COPY package.json package-lock.json ./
RUN npm ci
# Copy source code and build
COPY . .
RUN npm run build
# Production stage (Nginx)
FROM nginx:alpine
# Copy built files to Nginx
COPY --from=builder /app/dist /usr/share/nginx/html
# Default Nginx config for Single Page Apps (Vite)
RUN echo 'server { \
listen 80; \
location / { \
root /usr/share/nginx/html; \
index index.html; \
try_files $uri $uri/ /index.html; \
} \
}' > /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]