-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[[FEAT]] Add initial Docker/Containerfile
Having a local Containerfile allows anybody to build JSHint containers. Better yet, it allows JSHint to supply official Docker containers for users to use, rather then 'random containers from the internet'. Note, that Containerfile is a modern way to signify agnostic Containers. Internally, they are 100% pure Dockerfile's but for wider acceptance and inclusion, Containerfile is the modern take. The `--file Containerfile` argument might be needed for whichever builder is used. Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
- Loading branch information
Showing
5 changed files
with
127 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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 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 @@ | ||
failure-threshold: "style" | ||
ignored: | ||
- DL3007 | ||
- DL3008 | ||
- DL3013 | ||
- DL3018 |
This file contains 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,53 @@ | ||
# SPDX-License-Identifier: MIT | ||
# | ||
# Copyright (C) 2022 Olliver Schinagl <oliver@schinagl.nl> | ||
|
||
FROM index.docker.io/library/alpine:latest AS builder | ||
|
||
WORKDIR /src | ||
|
||
COPY . /src/ | ||
|
||
RUN apk add --no-cache \ | ||
git \ | ||
nodejs-current \ | ||
npm \ | ||
&& \ | ||
npm ci \ | ||
--no-fund \ | ||
--production \ | ||
--verbose \ | ||
&& \ | ||
mkdir -p '/jshint/node_modules/jshint' && \ | ||
cp -a 'node_modules/' '/jshint/' && \ | ||
cp -a 'bin/' 'data/' 'dist/' 'src/' 'package.json' \ | ||
'/jshint/node_modules/jshint' && \ | ||
npm ci \ | ||
--no-audit \ | ||
--no-fund \ | ||
--verbose \ | ||
&& \ | ||
npm run pretest && \ | ||
npm run test-262 && \ | ||
npm run test-node && \ | ||
npm run test-website && \ | ||
node '/jshint/node_modules/jshint/bin/jshint' --version | ||
|
||
|
||
FROM index.docker.io/library/alpine:latest | ||
|
||
LABEL maintainer="Olliver Schinagl <oliver@schinagl.nl>" | ||
|
||
RUN apk add --no-cache \ | ||
nodejs-current \ | ||
&& \ | ||
addgroup -S 'jshint' && \ | ||
adduser -D -G 'jshint' -h '/var/lib/jshint' -s '/bin/false' -S 'jshint' && \ | ||
ln -f -n -s '/usr/local/lib/node_modules/jshint/bin/jshint' '/usr/local/bin/jshint' | ||
|
||
COPY --from=builder "/jshint/node_modules/" "/usr/local/lib/node_modules" | ||
COPY "./containerfiles/container-entrypoint.sh" "/init" | ||
|
||
ENTRYPOINT [ "/init" ] | ||
|
||
USER 'jshint' |
This file contains 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 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,22 @@ | ||
#!/bin/sh | ||
# SPDX-License-Identifier: MIT | ||
# | ||
# Copyright (C) 2022 Olliver Schinagl <oliver@schinagl.nl> | ||
# | ||
# A beginning user should be able to docker run image bash (or sh) without | ||
# needing to learn about --entrypoint | ||
# https://github.com/docker-library/official-images#consistency | ||
|
||
set -eu | ||
|
||
# run command if it is not starting with a "-" and is an executable in PATH | ||
if [ "${#}" -le 0 ] || \ | ||
[ "${1#-}" != "${1}" ] || \ | ||
[ -d "${1}" ] || \ | ||
! command -v "${1}" > '/dev/null' 2>&1; then | ||
bin='jshint' | ||
fi | ||
|
||
exec ${bin:+${bin}} "${@}" | ||
|
||
exit 0 |