Git Product home page Git Product logo

docker-blackbox's Introduction

BlackBox Docker Image

This allows you to mount a git repo as a volume in the container and manage it with BlackBox and your host machine's ~/.ssh and ~/.gnupg directories.

Building docker image

In the Makefile there are commands for both building and pushing the image to DockerHub.

# Builds an image named 'stevenaldinger/docker-blackbox:latest'
make build \
  dockerhub_user='stevenaldinger' \
  version="latest"
# Pushes an image to 'stevenaldinger/docker-blackbox:latest'
make push \
  dockerhub_user='stevenaldinger' \
  version="latest"

Usage

In general, when you run this docker image it will set your git user name/email, make sure the gpg agent is running, and create a directory named .blackbox if it doesn't already exist in the directory mounted at /repo to store your BlackBox config in. Then it will run any command you pass in.

Example Docker Run

  1. cd into the git repo you want to manage with the image.

Then run the container as a daemon:

docker run --rm --name blackbox \
  -e GIT_USER_NAME="$(git config --get user.name)" \
  -e GIT_USER_EMAIL="$(git config --get user.email)" \
  -v $(pwd)/:/repo/ \
  -v "$HOME/.ssh":/root/.ssh \
  -v "$HOME/.gnupg":/root/.gnupg \
  -d stevenaldinger/docker-blackbox:latest \
  tail -f /dev/null
  1. cd into docker-blackbox/examples/
  2. Run ./01.initialize-repo.sh script
  3. Export your gpg key email address:
export GPG_KEY_EMAIL_ADDRESS='[email protected]'
  1. Run ./02.add-admin.sh to add yourself as a BlackBox admin.
  2. Run ./03.create-sensitive-file.sh to create a .env file.
  3. Run ./04.cat-sensitive-file.sh to view the encrypted .env file.
  4. Run ./05.edit-sensitive-file.sh to edit the encrypted .env file.
  5. Run docker kill blackbox to finish up.

Example Usage

The docker-compose.yml configuration runs tail -f /dev/null inside the container to keep it running and then the example files can be used to execute BlackBox commands inside the container.

For an example of how this image works:

  1. Set some important environment variables:
# used in the docker-compose.yml file
export GIT_USER_EMAIL="[email protected]"
export GIT_USER_NAME="Steven Aldinger"
# used in some of the example scripts
export GPG_KEY_EMAIL_ADDRESS='[email protected]'
  1. Run docker-compose up -d
  • runs a stevenaldinger/docker-blackbox:latest container named blackbox
  • creates a new directory ./example-repo on the host machine for usage the example scripts
  1. Run through each script in order in the examples/ directory.

Example Scripts

A directory of example scripts can be found at examples/ and include:

  1. Initializing a new repo with BlackBox
  2. Adding a BlackBox admin
  3. Creating a sensitive .env file and encrypting it
  4. Viewing the encrypted .env file
  5. Editing the encrypted .env file
  6. Leaving the .env file temporarily decrypted
  7. Re-encrypt the .env file
  8. Removing sensitive file from BlackBox

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.