Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(docker): Adding Dockerfile #5

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

t0mbombadil
Copy link

@t0mbombadil t0mbombadil commented May 26, 2024

Adding possiblity to run tool, in isolated container.

I made image as small as possible.
Although some additional complilation options targetting specific architecture might optimize it a little more.

For paranoid people image additional security hardening best practices were followed.

Overview

Run howto app in docker/podman container

Set up on shell

One time set up

./build.sh

# Set API key
## Could be set also in ~/.bashrc file or similar
read -s OPENAI_API_KEY ; echo "export OPENAI_API_KEY=$OPENAI_API_KEY" >> <some_rc_file_loaded_at_shell>

# Set alias 
echo "alias howto=\"$(realpath)/run.sh\"" >> ~/.bashrc

Usage

./run.sh "tar a file"

# Or with alias
howto "tar a file"

Security hardening

Image runs:

  • without (almost) any other filesystem files than binary itself (FROM scratch)
  • with non-root user

And provided run.sh script runs it with readonly container filesystem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant