44 lines
915 B
Docker
44 lines
915 B
Docker
# Build stage
|
|
FROM node:22-alpine AS builder
|
|
|
|
# Install git and pnpm
|
|
RUN apk add --no-cache git && \
|
|
corepack enable && \
|
|
corepack prepare pnpm@latest --activate
|
|
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# Clone the repository
|
|
RUN git clone https://git.raphaelforment.fr/BuboBubo/poof.git . && \
|
|
git log -1 --format="%H %s"
|
|
|
|
# Install dependencies
|
|
RUN pnpm install --frozen-lockfile
|
|
|
|
# Build the application
|
|
RUN pnpm build
|
|
|
|
# Production stage
|
|
FROM nginx:alpine
|
|
|
|
# Copy built files from builder stage
|
|
COPY --from=builder /app/dist /usr/share/nginx/html
|
|
|
|
# Copy nginx configuration for SPA routing
|
|
RUN echo 'server { \
|
|
listen 80; \
|
|
server_name localhost; \
|
|
root /usr/share/nginx/html; \
|
|
index index.html; \
|
|
location / { \
|
|
try_files $uri $uri/ /index.html; \
|
|
} \
|
|
}' > /etc/nginx/conf.d/default.conf
|
|
|
|
# Expose port 80
|
|
EXPOSE 80
|
|
|
|
# Start nginx
|
|
CMD ["nginx", "-g", "daemon off;"]
|