Transform .gitignore
into .dockerignore
.
.gitignore |
.dockerignore |
---|---|
!/ |
! |
! |
!**/ |
/ |
- |
- | **/ |
Check releases.
g2d
will detect the nearest .gitignore
by default.
# stdout
g2d
# specific file
g2d foo/.gitignore
# export to ./.dockerignore
g2d -o .
# if foo is a directory
# .dockerignore would be exported to foo/.dockerignore
g2d -o foo
cat foo/.gitignore
# if foo is a file
# .dockerignore would be exported to foo
g2d -o foo
cat foo
# from stdin to stdout
cat .gitignore | g2d > .dockerignore
# more
g2d -h
# install from remote
deno install \
--unstable \
--allow-read \
--allow-write \
-n g2d \
https://deno.land/x/g2d/bin.ts
# install from local repo
git clone git@github.com:VdustR/g2d.git
deno install \
--unstable \
--allow-read \
--allow-write \
-n g2d \
bin.ts
# uninstall
rm $(which g2d)
import g2b from "https://deno.land/x/g2d/mod.ts";
const gitignore = Deno.readTextFileSync(".gitignore");
const dockerignore = g2b(gitignore);
Deno.writeTextFileSync(".dockerignore", dockerignore);
Check g2d container.
podman run --rm -it -v $(pwd):/repo g2d g2d /repo/.gitignore -o /repo
deno run --unstable --allow-read --allow-write bin.ts
./scripts/test.sh
deno 1.19.1 (release, x86_64-unknown-linux-gnu)
v8 9.9.115.7
typescript 4.5.2
MIT