jscpd
jscpd copied to clipboard
Add Dockerfile for running & self-building jscpd image
Is your feature request related to a problem? Please describe. Running software not in containers is less secure (no isolation) and less stable (software stop working due to system updates/modifications).
Describe the solution you'd like Add Dockerfile (or several) to the repo:
- for self-building jscpd from git repo (for development)
- for running jscpd (installation without devDependencies)
I already have Dockerfile that I use for 2 scenraio, will publish it in comment here soon, after more testing to it.
Here the Containerfile
that I use on latest fedora:
Build by: podman build --rm -t jscpd .
Run by: podman run --name jscpd -v $(pwd):/f/:ro,Z -v jscpdreports:/home/appuser/report/ --network none --rm jscpd --reporters html,consoleFull --mode strict /f
Html result is in the created volume jscpdreports
(it assumed the default ./report/ is used), location of files of the volume is returned in command podman volume inspect jscpdreports
it will pass the current directory to /f
directory inside the container which doesn't have network access (to ensure data not leaked)
FROM docker.io/node:alpine
RUN set -ex; \
apk update; \
apk upgrade; \
# Runtime deps: (for 'jscpd/git blame' operation)
apk add --no-cache git; \
adduser -D appuser
USER appuser
WORKDIR /home/appuser/
ENV NODE_ENV="production"
RUN set -ex; \
npm install --production --ignore-scripts --no-optional jscpd jscpd-badge-reporter; \
mkdir /home/appuser/report/
VOLUME /home/appuser/report/
ENTRYPOINT ["/home/appuser/node_modules/jscpd/bin/jscpd"]
CMD ["--help"]
development Containerfile: (it's using COPY instruction, should be run after git clone
or master.zip download)
FROM docker.io/node:alpine
RUN set -ex; \
apk update; \
apk upgrade; \
# Runtime deps: (for 'jscpd/git blame' operation)
apk add --no-cache git; \
adduser -D appuser
USER appuser
WORKDIR /home/appuser/jscpdcode/
ENV NODE_ENV="development"
COPY . /home/appuser/jscpdcode/
RUN set -ex; \
npm install --development; \
mkdir /home/appuser/report/
VOLUME /home/appuser/report/
ENTRYPOINT ["/home/appuser/jscpdcode/packages/jscpd/bin/jscpd"]
CMD ["--help"]
A short solution: https://github.com/hata6502/jscpd-docker
Dockerfile:
FROM node:14.15.5-alpine3.13
RUN npm install -g jscpd
WORKDIR /target
CMD jscpd