-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile.frontend-realdeal
More file actions
49 lines (35 loc) · 1.32 KB
/
Copy pathDockerfile.frontend-realdeal
File metadata and controls
49 lines (35 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# Multi-stage build for RealDeal Frontend
# Stage 1: Builder
FROM node:20-alpine AS builder
WORKDIR /app
# Copy monorepo root
COPY package*.json turbo.json tsconfig.json ./
# Copy workspace packages
COPY autodiscovery-contract autodiscovery-contract/
COPY frontend-realdeal frontend-realdeal/
# Install dependencies
RUN npm ci
# Build contract first (required by frontend)
RUN cd autodiscovery-contract && npm run build
# Copy contract assets to frontend public directory
RUN cd frontend-realdeal && npm run copy-contracts || true
# Build frontend with Vite
RUN cd frontend-realdeal && npm run build
# Stage 2: Runtime (nginx)
FROM nginx:1.27-alpine
# Copy nginx configuration
COPY frontend-realdeal/nginx.conf /etc/nginx/nginx.conf
COPY frontend-realdeal/default.conf /etc/nginx/conf.d/default.conf
# Copy built frontend from builder
COPY --from=builder /app/frontend-realdeal/dist /usr/share/nginx/html
# Create non-root user (nginx already runs as non-root)
# Set proper permissions
RUN chown -R nginx:nginx /usr/share/nginx/html && \
chmod -R 555 /usr/share/nginx/html
# Expose port
EXPOSE 80 443
# Healthcheck
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD wget --quiet --tries=1 --spider http://localhost/health || exit 1
# Use nginx's default entrypoint
CMD ["nginx", "-g", "daemon off;"]