Skip to content
Closed
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
21 changes: 21 additions & 0 deletions .github/workflows/pages-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,24 @@ jobs:
- name: Check bundle size
working-directory: pages
run: npm run size

build-container:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v7

- name: Trust workspace
run: git config --global --replace-all safe.directory '*'

- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v4
Comment thread
wu21-web marked this conversation as resolved.

- name: Debug Docker Info
run: docker info

- name: Build and push Docker image
uses: docker/build-push-action@v7
Comment thread
wu21-web marked this conversation as resolved.
with:
context: pages/
push: false
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ coverage.html
.claude/commands/read-issue.md
.claude/settings.local.json

pages/package-lock.json
scripts/hooks/
scripts/publish/.env.internal
CHANGELOG.md
Expand Down
6 changes: 6 additions & 0 deletions pages/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
node_modules
dist
.git
*.md
!README.md
.DS_Store
20 changes: 20 additions & 0 deletions pages/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM node:22-alpine AS build
LABEL org.opencontainers.image.source=https://github.com/alibaba/open-code-review

WORKDIR /app

COPY package.json package-lock.json ./
RUN npm ci

COPY . .
RUN npm run build

FROM nginx:1.27-alpine

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

COPY --from=build /app/dist /usr/share/nginx/html

EXPOSE 80

CMD ["nginx", "-g", "daemon off;"]
31 changes: 31 additions & 0 deletions pages/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
server {
listen 80;
server_name localhost;

root /usr/share/nginx/html;
index index.html;

# Security headers
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;

location / {
location ~ \.html$ {
add_header Cache-Control "no-cache, no-store, must-revalidate";
try_files $uri /index.html;
}

location ~ \.(js|css|woff2?|svg|png|jpg|jpeg|gif|ico)$ {
add_header Cache-Control "public, max-age=31536000, immutable";
try_files $uri =404;
}

try_files $uri /index.html;
}

# Gzip compression
gzip on;
gzip_types text/html text/css application/javascript application/json image/svg+xml;
gzip_min_length 256;
}
Loading