-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
45 lines (33 loc) · 919 Bytes
/
Copy pathDockerfile
File metadata and controls
45 lines (33 loc) · 919 Bytes
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
# Stage 1: Build the React app using Vite
FROM node:22-alpine AS builder
# Set environment variables
ARG VITE_BASE_URL
ARG VITE_AUDIO_BASE_URL
ARG VITE_LIVEBLOCKS_PUBKEY
ARG VITE_SUPABASE_ANON_KEY
ARG VITE_SUPABASE_URL
ARG VITE_AUTH_REDIRECT_URL
ARG VITE_POSTHOG_KEY
ARG VITE_POSTHOG_HOST
# Set working directory
WORKDIR /app
# Copy package.json and package-lock.json
COPY package.json package-lock.json ./
# Install dependencies
RUN npm ci
# Copy all source files
COPY . .
# Build the application
RUN npm run build
# Stage 2: Serve the React app with Nginx
FROM nginx:stable-alpine
# Remove default Nginx static assets
RUN rm -rf /usr/share/nginx/html/*
# Copy built assets from builder stage
COPY --from=builder /app/dist /usr/share/nginx/html
# Copy custom Nginx configuration
COPY nginx.conf /etc/nginx/conf.d/default.conf
# Expose port 8080
EXPOSE 8080
# Start Nginx
CMD ["nginx", "-g", "daemon off;"]