Skip to content

Commit ef74642

Browse files
feat: added support for docker (#175)
* fix: added missing titles in diffview of v2 * fix: using v2 link for sample link in docs * feat: support docker (#174) * feat: add docker * fix: nginx failed to load * docs: update README.md * chore: change to npm ci and remove static in nuxt.config.js * docs: update server to serve * docs: add Self Host section --------- Co-authored-by: Nux <88309796+muhammad-asn@users.noreply.github.com>
1 parent f8a6926 commit ef74642

File tree

5 files changed

+170
-1
lines changed

5 files changed

+170
-1
lines changed

.dockerignore

+90
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# Created by .ignore support plugin (hsz.mobi)
2+
### Node template
3+
# Logs
4+
/logs
5+
*.log
6+
npm-debug.log*
7+
yarn-debug.log*
8+
yarn-error.log*
9+
10+
# Runtime data
11+
pids
12+
*.pid
13+
*.seed
14+
*.pid.lock
15+
16+
# Directory for instrumented libs generated by jscoverage/JSCover
17+
lib-cov
18+
19+
# Coverage directory used by tools like istanbul
20+
coverage
21+
22+
# nyc test coverage
23+
.nyc_output
24+
25+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
26+
.grunt
27+
28+
# Bower dependency directory (https://bower.io/)
29+
bower_components
30+
31+
# node-waf configuration
32+
.lock-wscript
33+
34+
# Compiled binary addons (https://nodejs.org/api/addons.html)
35+
build/Release
36+
37+
# Dependency directories
38+
node_modules/
39+
jspm_packages/
40+
41+
# TypeScript v1 declaration files
42+
typings/
43+
44+
# Optional npm cache directory
45+
.npm
46+
47+
# Optional eslint cache
48+
.eslintcache
49+
50+
# Optional REPL history
51+
.node_repl_history
52+
53+
# Output of 'npm pack'
54+
*.tgz
55+
56+
# Yarn Integrity file
57+
.yarn-integrity
58+
59+
# dotenv environment variables file
60+
.env
61+
62+
# parcel-bundler cache (https://parceljs.org/)
63+
.cache
64+
65+
# next.js build output
66+
.next
67+
68+
# nuxt.js build output
69+
.nuxt
70+
71+
# Nuxt generate
72+
dist
73+
74+
# vuepress build output
75+
.vuepress/dist
76+
77+
# Serverless directories
78+
.serverless
79+
80+
# IDE / Editor
81+
.idea
82+
83+
# Service worker
84+
sw.*
85+
86+
# macOS
87+
.DS_Store
88+
89+
# Vim swap files
90+
*.swp

Dockerfile

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
FROM node:18 AS build-stage
2+
3+
WORKDIR /app
4+
5+
COPY package*.json ./
6+
7+
RUN npm ci
8+
9+
COPY . .
10+
11+
ENV NODE_OPTIONS=--openssl-legacy-provider
12+
RUN npm run generate
13+
14+
FROM nginx:1.27.0-alpine-slim AS production-stage
15+
16+
COPY --from=build-stage /app/dist /usr/share/nginx/html
17+
18+
COPY nginx/default.conf /etc/nginx/conf.d/default.conf
19+
20+
EXPOSE 80
21+
22+
CMD ["nginx", "-g", "daemon off;"]

README.md

+27-1
Large diffs are not rendered by default.

docker-compose.yml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
services:
2+
offline-diff-viewer:
3+
build:
4+
context: .
5+
dockerfile: Dockerfile
6+
container_name: offline-diff-viewer
7+
ports:
8+
- "3000:80"
9+
security_opt:
10+
- no-new-privileges:true
11+
volumes:
12+
- /var/log/nginx
13+
restart: unless-stopped
14+
environment:
15+
- NODE_ENV=production
16+
- NODE_OPTIONS=--openssl-legacy-provider

nginx/default.conf

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
server {
2+
listen 80;
3+
server_name offline-diff-viewer.local;
4+
5+
location / {
6+
charset utf-8;
7+
root /usr/share/nginx/html;
8+
try_files $uri $uri/ /index.html;
9+
}
10+
11+
error_page 500 502 503 504 /50x.html;
12+
location = /50x.html {
13+
root /usr/share/nginx/html;
14+
}
15+
}

0 commit comments

Comments
 (0)