Skip to content
Merged
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
9 changes: 5 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,18 @@ WORKDIR /app

RUN apk add --no-cache git

COPY . .
COPY --exclude=node_modules . .
RUN npm ci

RUN npm run build

FROM nginx:alpine
FROM nginx:1-alpine

COPY --from=builder /app/dist/client /usr/share/nginx/html

COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY ./docker/nginx.conf /etc/nginx/nginx.conf
COPY ./docker/default.conf /etc/nginx/conf.d/default.conf

EXPOSE 80
EXPOSE 8080

CMD ["nginx", "-g", "daemon off;"]
2 changes: 1 addition & 1 deletion docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ services:
dockerfile: Dockerfile
container_name: orca-docs
ports:
- "127.0.0.1:8080:80"
- "127.0.0.1:8080:8080"
restart: unless-stopped
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ services:
image: orcacd/docs:latest
container_name: orca-docs
ports:
- "127.0.0.1:8080:80"
- "127.0.0.1:8080:8080"
restart: unless-stopped
37 changes: 37 additions & 0 deletions docker/default.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
server {
listen 8080;
server_name localhost;
root /usr/share/nginx/html;
index index.html;

location / {

# Prevent duplicate routes with and without .html extension
# Handle subdirectory index.html (e.g., /about/index.html -> /about)
if ($request_uri ~ ^/(.+)/index(\.html)?(\?|$)) {
return 301 /$1;
}

# Handle root index.html (/index.html -> /)
if ($request_uri ~ ^/index(\.html)?(\?|$)) {
return 301 /;
}

#Handle other .html files (e.g., /about.html -> /about)
if ($request_uri ~ ^/(.*)\.html(\?|$)) {
return 301 /$1;
}

try_files $uri $uri/ /index.html;
}

# assets, media
location ~* \.(?:css(\.map)?|js(\.map)?|jpe?g|png|gif|ico|cur|heic|webp|tiff?|mp3|m4a|aac|ogg|midi?|wav|mp4|mov|webm|mpe?g|avi|ogv|flv|wmv)$ {
expires 7d;
}

# svg, fonts
location ~* \.(?:svgz?|ttf|ttc|otf|eot|woff2?)$ {
expires 7d;
}
}
34 changes: 34 additions & 0 deletions docker/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
user nginx;
worker_processes auto;

error_log /var/log/nginx/error.log notice;
pid /run/nginx.pid;


events {
multi_accept on;
worker_connections 1024;
}


http {
charset utf-8;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;

server_tokens off;
log_not_found off;
access_log off;

client_max_body_size 16M;

include /etc/nginx/mime.types;
default_type application/octet-stream;

absolute_redirect off;
port_in_redirect off;

include /etc/nginx/conf.d/*.conf;
}
10 changes: 0 additions & 10 deletions nginx.conf

This file was deleted.