Skip to main content
Deno 2 is finally here 🎉️
Learn more

g2d

Test Release ghcr

Transform .gitignore into .dockerignore.

.gitignore .dockerignore
!/ !
! !**/
/ -
- **/

Download

Check releases.

Usage

g2d will detect the nearest .gitignore by default.

# std output
g2d

# 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

# more
g2d -h

Install with Deno

git clone git@github.com:VdustR/g2d.git
deno install --importmap=import_map.json \
  --unstable \
  --allow-read \
  --allow-write \
  -n g2d \
  bin.ts

# uninstall
rm $(which g2d)

Deno Library

import g2b from "https://deno.land/x/g2d/g2d.ts";

const gitignore = Deno.readTextFileSync(".gitignore");
const dockerignore = g2b(gitignore);
Deno.writeTextFileSync(".dockerignore", dockerignore);

Container

Check g2d container.

Dev

deno run --importmap=import_map.json --unstable --allow-read --allow-write bin.ts

Test

./scripts/test-watch.sh

Tested Dev Env

deno 1.14.3 (release, x86_64-unknown-linux-gnu)
v8 9.4.146.19
typescript 4.4.2

License

MIT