oxidized-script
oxidized-script copied to clipboard
Use Oxidized Script with official docker image
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.
Also running into this... following :)
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