diff --git a/docker/.bashrc b/docker/.bashrc new file mode 100644 index 0000000..248a838 --- /dev/null +++ b/docker/.bashrc @@ -0,0 +1,12 @@ +# Stoken +# # To refresh tokens: +# # Backup old stokenrc +# `cp ~/.stokenrc ~/.stokenrc.bak; rm ~/.stokenrc` +# # Import new token & remember not to enter a password at prompt +# `docker run -it -v /Users/smcquaid:/root stevemcquaid/stoken:latest stoken import --file=/root/.stoken/smcquaid_000700590089.sdtid` +# # If you do enter a password in previous step, unset it with this command +# `docker run -it -v /Users/smcquaid:/root stevemcquaid/stoken:latest stoken setpass` +# # Then run `stoken` to test +stoken() { + docker run -it -v /Users/smcquaid:/root stevemcquaid/stoken:latest stoken +} diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..ca967f0 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,26 @@ +FROM ubuntu:16.04 + +RUN apt-get update +RUN apt-get install -y \ + libgtk-3-dev \ + libtomcrypt-dev \ + libxml2-dev \ + libtomcrypt-dev \ + autoconf \ + automake \ + libtool \ + build-essential \ + git + +RUN git clone git://github.com/cernekee/stoken + +WORKDIR stoken + +RUN bash autogen.sh && \ + ./configure && \ + make && \ + make check && \ + make install && \ + ldconfig + +CMD stoken \ No newline at end of file diff --git a/docker/Makefile b/docker/Makefile new file mode 100755 index 0000000..a5e65b6 --- /dev/null +++ b/docker/Makefile @@ -0,0 +1,26 @@ +## Build container +build: + @bash -x scripts/build.sh + +## Push container +push: + @bash -x scripts/push.sh + +## Run project +run: + @bash -x scripts/run.sh + +help: + @printf "Available targets:\n\n" + @awk '/^[a-zA-Z\-\_0-9%:\\]+:/ { \ + helpMessage = match(lastLine, /^## (.*)/); \ + if (helpMessage) { \ + helpCommand = $$1; \ + helpMessage = substr(lastLine, RSTART + 3, RLENGTH); \ + gsub("\\\\", "", helpCommand); \ + gsub(":+$$", "", helpCommand); \ + printf " \x1b[32;01m%-35s\x1b[0m %s\n", helpCommand, helpMessage; \ + } \ + } \ + { lastLine = $$0 }' $(MAKEFILE_LIST) | sort -u + @printf "\n" \ No newline at end of file diff --git a/docker/scripts/build.sh b/docker/scripts/build.sh new file mode 100755 index 0000000..3a2b2c6 --- /dev/null +++ b/docker/scripts/build.sh @@ -0,0 +1,4 @@ +#!/bin/bash +set -ex + +docker build -t stevemcquaid/stoken:latest . diff --git a/docker/scripts/run.sh b/docker/scripts/run.sh new file mode 100755 index 0000000..bc9db1c --- /dev/null +++ b/docker/scripts/run.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +docker run -it -v $HOME:/root stevemcquaid/stoken:latest stoken $@ +