Skip to content

Commit

Permalink
feat: added support for docker (#175)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
technikhil314 and muhammad-asn authored Jul 27, 2024
1 parent f8a6926 commit ef74642
Show file tree
Hide file tree
Showing 5 changed files with 170 additions and 1 deletion.
90 changes: 90 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# Created by .ignore support plugin (hsz.mobi)
### Node template
# Logs
/logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# parcel-bundler cache (https://parceljs.org/)
.cache

# next.js build output
.next

# nuxt.js build output
.nuxt

# Nuxt generate
dist

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless

# IDE / Editor
.idea

# Service worker
sw.*

# macOS
.DS_Store

# Vim swap files
*.swp
22 changes: 22 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM node:18 AS build-stage

WORKDIR /app

COPY package*.json ./

RUN npm ci

COPY . .

ENV NODE_OPTIONS=--openssl-legacy-provider
RUN npm run generate

FROM nginx:1.27.0-alpine-slim AS production-stage

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

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

EXPOSE 80

CMD ["nginx", "-g", "daemon off;"]
28 changes: 27 additions & 1 deletion README.md

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
services:
offline-diff-viewer:
build:
context: .
dockerfile: Dockerfile
container_name: offline-diff-viewer
ports:
- "3000:80"
security_opt:
- no-new-privileges:true
volumes:
- /var/log/nginx
restart: unless-stopped
environment:
- NODE_ENV=production
- NODE_OPTIONS=--openssl-legacy-provider
15 changes: 15 additions & 0 deletions nginx/default.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
server {
listen 80;
server_name offline-diff-viewer.local;

location / {
charset utf-8;
root /usr/share/nginx/html;
try_files $uri $uri/ /index.html;
}

error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}

0 comments on commit ef74642

Please sign in to comment.