-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathDockerfile
55 lines (39 loc) · 1.43 KB
/
Dockerfile
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
52
53
54
55
# Use an official Node.js runtime as the base image
FROM node:20-alpine AS base
FROM base AS builder
RUN apk update
RUN apk add --no-cache libc6-compat
# Set working directory
WORKDIR /app
RUN npm install -g [email protected]
# Copy package.json and package-lock.json (if available)
COPY . .
RUN turbo prune ecc-docs --docker
FROM base AS installer
RUN apk update
RUN apk add --no-cache libc6-compat
WORKDIR /app
COPY --from=builder /app/out/json/ .
# Install dependencies
RUN npm ci
COPY scripts /app/scripts
# Build the application
COPY --from=builder /app/out/full/ .
RUN npm run build --filter=ecc-docs...
# Use a lightweight web server to serve static files
FROM nginx:alpine
# Copy the built static files from the previous stage
COPY --from=installer /app/apps/documentation/out /usr/share/nginx/html
# Copy the Nginx configuration file
COPY --from=builder /app/apps/documentation/nginx.conf /etc/nginx/conf.d/default.conf
# support running as arbitrary user which belogs to the root group
RUN chmod g+rwx /var/cache/nginx /var/run /var/log/nginx && \
chown nginx.root /var/cache/nginx /var/run /var/log/nginx && \
# comment user directive as master process is run as user in OpenShift anyhow
sed -i.bak 's/^user/#user/' /etc/nginx/nginx.conf && \
# Make /etc/nginx/html/ available to use
mkdir -p /etc/nginx/html/ && chmod 777 /etc/nginx/html/
# Expose port 80
EXPOSE 8080
# Start Nginx
CMD ["nginx", "-g", "daemon off;"]