feat: add Dockerfile for frontend deployment
Some checks are pending
K3s Auto-Deploy / build-and-deploy (push) Waiting to run
Some checks are pending
K3s Auto-Deploy / build-and-deploy (push) Waiting to run
This commit is contained in:
parent
7a06d4e691
commit
c7ba7586b8
1 changed files with 32 additions and 0 deletions
32
frontend/Dockerfile
Normal file
32
frontend/Dockerfile
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
# 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;"]
|
||||||
Loading…
Reference in a new issue