-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
51 lines (39 loc) · 1.07 KB
/
Copy pathDockerfile
File metadata and controls
51 lines (39 loc) · 1.07 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
50
51
# Build stage
FROM node:20-alpine AS builder
WORKDIR /app
# Copy package files
COPY package*.json ./
# Install dependencie
RUN npm ci --legacy-peer-deps
# Copy source code
COPY . .
# Build args
ARG VITE_OPENROUTER_API_KEY
ARG VITE_OPENAI_API_KEY
ARG VITE_PERPLEXITY_API_KEY
ARG VITE_DEEPSEEK_API_KEY
ARG VITE_DRUGBANK_API_KEY
ARG VITE_CHEMSPIDER_API_KEY
ARG VITE_SUPABASE_URL
ARG VITE_SUPABASE_ANON_KEY
# Build the application
RUN npm run build
# Production stage
FROM nginx:1.31.2-alpine3.23-slim
# Default port explicit
ENV PORT=80
# Copy built assets from builder stage
COPY --from=builder /app/dist /usr/share/nginx/html
# Add custom nginx config template for SPA routing
# Nginx docker image automatically enables envsubst for files in /etc/nginx/templates
RUN mkdir -p /etc/nginx/templates
RUN echo 'server { \
listen ${PORT}; \
location / { \
root /usr/share/nginx/html; \
index index.html index.htm; \
try_files $uri $uri/ /index.html; \
} \
}' > /etc/nginx/templates/default.conf.template
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]