Skip to content

Commit eee2081

Browse files
committed
chore: dockerfile docs
1 parent acd9397 commit eee2081

File tree

2 files changed

+51
-7
lines changed

2 files changed

+51
-7
lines changed

Dockerfile

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,44 @@
11
# Use an official Node.js runtime as the base image
2-
FROM node:20-alpine
2+
FROM node:20-alpine AS base
33

4-
# Set the working directory in the container
4+
FROM base AS builder
5+
RUN apk update
6+
RUN apk add --no-cache libc6-compat
7+
# Set working directory
58
WORKDIR /app
69

10+
RUN npm install -g turbo@1.13.0
11+
712
# Copy package.json and package-lock.json (if available)
8-
COPY package*.json ./
13+
COPY . .
14+
15+
RUN turbo prune ecc-docs --docker
16+
17+
FROM base AS installer
18+
RUN apk update
19+
RUN apk add --no-cache libc6-compat
20+
21+
WORKDIR /app
22+
23+
COPY --from=builder /app/out/json/ .
924

1025
# Install dependencies
1126
RUN npm ci
1227

13-
# Copy the rest of the application code
14-
COPY . .
28+
COPY scripts /app/scripts
1529

1630
# Build the application
17-
RUN npm run build
31+
COPY --from=builder /app/out/full/ .
32+
RUN npm run build --filter=ecc-docs...
1833

1934
# Use a lightweight web server to serve static files
2035
FROM nginx:alpine
2136

2237
# Copy the built static files from the previous stage
23-
COPY --from=0 /app/apps/documentation/out /usr/share/nginx/html
38+
COPY --from=installer /app/apps/documentation/out /usr/share/nginx/html
39+
40+
# Copy the Nginx configuration file
41+
COPY --from=builder /app/apps/documentation/nginx.conf /etc/nginx/conf.d/default.conf
2442

2543
# Expose port 80
2644
EXPOSE 80

apps/documentation/nginx.conf

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
server {
2+
listen 80;
3+
server_name localhost;
4+
root /usr/share/nginx/html;
5+
index index.html;
6+
7+
location / {
8+
try_files $uri $uri.html $uri/ /index.html;
9+
}
10+
11+
location /_next/static/ {
12+
alias /usr/share/nginx/html/_next/static/;
13+
expires 365d;
14+
access_log off;
15+
}
16+
17+
location ~* \.(jpg|jpeg|png|gif|ico|css|js)$ {
18+
expires 365d;
19+
access_log off;
20+
}
21+
22+
error_page 404 /404.html;
23+
location = /404.html {
24+
internal;
25+
}
26+
}

0 commit comments

Comments
 (0)