-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
51 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,44 @@ | ||
# Use an official Node.js runtime as the base image | ||
FROM node:20-alpine | ||
FROM node:20-alpine AS base | ||
|
||
# Set the working directory in the container | ||
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 package*.json ./ | ||
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 the rest of the application code | ||
COPY . . | ||
COPY scripts /app/scripts | ||
|
||
# Build the application | ||
RUN npm run build | ||
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=0 /app/apps/documentation/out /usr/share/nginx/html | ||
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 | ||
|
||
# Expose port 80 | ||
EXPOSE 80 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
server { | ||
listen 80; | ||
server_name localhost; | ||
root /usr/share/nginx/html; | ||
index index.html; | ||
|
||
location / { | ||
try_files $uri $uri.html $uri/ /index.html; | ||
} | ||
|
||
location /_next/static/ { | ||
alias /usr/share/nginx/html/_next/static/; | ||
expires 365d; | ||
access_log off; | ||
} | ||
|
||
location ~* \.(jpg|jpeg|png|gif|ico|css|js)$ { | ||
expires 365d; | ||
access_log off; | ||
} | ||
|
||
error_page 404 /404.html; | ||
location = /404.html { | ||
internal; | ||
} | ||
} |