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

Use Oxidized Script with official docker image #40

Open
mtucker502 opened this issue Jul 8, 2021 · 2 comments
Open

Use Oxidized Script with official docker image #40

mtucker502 opened this issue Jul 8, 2021 · 2 comments

Comments

@mtucker502
Copy link

Is it possible to use oxidized-script with the official Docker image?

I have a use case where we want to run Oxidized in a container but also have access to run oxidized-script.

@nebriv
Copy link

nebriv commented Aug 20, 2021

Also running into this... following :)

@nebriv
Copy link

nebriv commented Aug 20, 2021

I made this work, albeit a bit hacky and a bit sketchy. But it suited our needs for a Friday afternoon...

In the docker container we've installed oxidized-script (we're already building this separately due to other customizations we're making).

...
RUN rake install

# web interface
RUN gem install oxidized-web --no-ri --no-rdoc

# OXS
RUN gem install oxidized-script --no-ri --no-rdoc

# clean up
WORKDIR /
RUN rm -rf /tmp/oxidized
...

I've then created a little shell script and tossed it in /usr/loca/bin/oxs on our host:

ARGS=$@
POSITIONAL=()
while [[ $# -gt 0 ]]; do
  key="$1"
  case $key in
    -x|--commands)
      COMMANDFILE="$2"
      shift # past argument
      shift # past value
      ;;
    *)    # unknown option
      POSITIONAL+=("$1") # save it in an array for later
      shift # past argument
      ;;
 esac
done

if [ ! -z "$COMMANDFILE" ]
then
    echo "Copying $COMMANDFILE"
    docker cp $COMMANDFILE oxidized-docker_oxidized_1:$COMMANDFILE
fi
echo "Running: $ARGS"
docker exec -it oxidized-docker_oxidized_1 oxs $ARGS
if [ ! -z "$COMMANDFILE" ]
then
    echo "Removing $COMMANDFILE"
    docker exec -it oxidized-docker_oxidized_1 rm -rf $COMMANDFILE
fi

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

No branches or pull requests

2 participants