Skip to content

Commit

Permalink
Support for Docker Image (#50)
Browse files Browse the repository at this point in the history
* Adds docker ignore file for specifying the context

* Updates package.json and package-lock.json files

* Adds Dockerfile

* Updates README.md
  • Loading branch information
anuragagarwal561994 authored Aug 14, 2023
1 parent d521775 commit 50289e2
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 3 deletions.
16 changes: 16 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Ignore everything
*

# Allow files and directories
!src/*
!webpack.config.js
!package.json
!package-lock.json
!.babelrc

# Ignore unnecessary files inside allowed directories
# This should go after the allowed directories
**/*~
**/*.log
**/.DS_Store
**/Thumbs.db
14 changes: 14 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM node:18-alpine as build-deps

WORKDIR /usr/src/app
ENV NODE_OPTIONS=--openssl-legacy-provider
COPY package.json package-lock.json ./
RUN npm install
COPY . ./
RUN npm run release-build

FROM nginx:alpine

COPY --from=build-deps /usr/src/app/build /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,15 @@ Use the [issue tracker](https://github.com/jzillmann/jmh-visualizer/issues) and/
- ```npm run release``` Build production version
- ```npm run deploy``` Build production version & move it to the github pages fodler

#### Docker Build & Run

```bash
docker build . -t jmh-visualizer
docker run --rm -d -p 80:80 --name jmh-visualizer jmh-visualizer
```

Now you can access the UI on ```http://localhost```.

#### Realease
- Increase version in package.json
- Update README.md in case of major releases
Expand Down
5 changes: 3 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"lint": "eslint . --ext .js --ext .jsx --cache",
"test": "NODE_ENV=testing NODE_PATH=./src/javascript mocha --compilers js:babel-core/register test --recursive",
"check": "npm run lint && npm run test",
"release": "npm run check && rm -rf build/* && NODE_ENV=production webpack --mode production",
"release-build": "rm -rf build/* && NODE_ENV=production webpack --mode production",
"release": "npm run check && npm run release-build",
"deploy": "npm run release && cp -r build/* docs/",
"providedZip": "npm run release && cd build && zip -r ../jmh-visualizer.zip ./*"
},
Expand Down

0 comments on commit 50289e2

Please sign in to comment.