Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docker-compose-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ services:
dockerfile: prod.dockerfile
restart: always
ports:
- "3000:3000"
- "80:80"
46 changes: 46 additions & 0 deletions nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
events {
worker_connections 1024;
}

worker_processes auto;

http {
include /etc/nginx/mime.types;

server {
listen 80;
root /usr/share/nginx/html;
index index.html;

# Enable gzip
gzip on;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml text/javascript image/svg+xml application/font-woff application/font-woff2;

rewrite ^/documentation/open-source/(.*)$ /$1 last;

# handle redirection from root
location = / {
return 301 /documentation/open-source/1.4.0/;
}

location / {
try_files $uri $uri/ $uri/index.html /1.4.0/index.html;
}

# Cache static assets with fingerprints for 1 yr (Docusaurus adds hashes)
location ~* \.[a-f0-9]+\.(js|css)$ {
add_header Cache-Control "public, max-age=31536000, immutable";
}

# Cache images and fonts for shorter time i.e. 7 days
location ~* \.(png|jpg|gif|ico|svg|woff|woff2)$ {
add_header Cache-Control "public, max-age=604800";
}

# Don't cache HTML files
# This will now work correctly with the rewritten URI.
location ~* \.html$ {
add_header Cache-Control "no-cache, no-store, must-revalidate";
}
}
}
12 changes: 7 additions & 5 deletions prod.dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
FROM node:18.2.0-alpine as builder
FROM node:18.2.0-alpine AS builder
WORKDIR /build
COPY package.json ./
COPY package-lock.json ./
RUN npm install
RUN npm ci
COPY . ./
RUN npm run build

EXPOSE 3000
ENTRYPOINT ["npm", "run"]
CMD ["serve"]
FROM nginx:stable-alpine
COPY --from=builder /build/build /usr/share/nginx/html
COPY nginx.conf /etc/nginx/nginx.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]