-
Notifications
You must be signed in to change notification settings - Fork 1.5k
feat(pages): add Dockerfile for server hosting #878
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
7a4f22b
add dockerignore
wu21-web f7cee97
press Dockerfile in pages/
wu21-web 6b7094d
qwq
wu21-web 6b8b81e
ci: test the Dockerfile
wu21-web 0b9995a
restore package-lock
wu21-web e00a94a
naming issue
wu21-web deb09e8
formatiing
wu21-web 072ea3d
Merge branch 'main' into docker
wu21-web File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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,6 @@ | ||
| node_modules | ||
| dist | ||
| .git | ||
| *.md | ||
| !README.md | ||
| .DS_Store |
This file contains hidden or 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,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;"] |
This file contains hidden or 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,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; | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.