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

Dockerize #48

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

Dockerize #48

wants to merge 3 commits into from

Conversation

stevemcquaid
Copy link

Happy to modify as needed

cernekee pushed a commit that referenced this pull request Sep 12, 2018
@cernekee
Copy link
Collaborator

I played around with this a little bit and pushed a couple of small tweaks to the scripts on a branch. As a Docker noob, I'd like to flesh this out a little more before deciding whether to commit to master.

One basic question is: what is the intended use case for running stoken in a Docker container? Is there another project (either active, or under development) that is utilizing stoken in this configuration?

Is the intention to always run stoken (alone) in its own container, or will there be other services/daemons/etc. running in the same container and (say) calling into libstoken to generate tokencodes?

Adding a little context + Docker instructions to the README might be helpful. Ideally the docs would explain when/why this would come in handy, and include a short "cookbook" of commands that a user could copy&paste to get started.

If you don't need stoken-gui, you should be able to safely omit libgtk-3-dev, which I believe pulls in a massive number of dependencies. If you do intend to run stoken-gui from within the container, some trickery might be needed to forward the X11 connections.

make -C docker run executes stoken with no arguments, which may or may not be what you want. Is docker/Makefile a pretty standard wrapper, or would it make sense to just ship the "raw" scripts in this case?

push.sh seems to be missing.

@mtmiller
Copy link
Contributor

what is the intended use case for running stoken in a Docker container?

Agree, I suspect a flatpak or snap containerized app of stoken/stoken-gui might be more useful.

@@ -0,0 +1,26 @@
FROM ubuntu:16.04
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These large tabs should be reduced to a single space, I have never seen a Dockerfile formatted this way.

FROM ubuntu:16.04

RUN apt-get update
RUN apt-get install -y \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These should be combined into a single command with &&.

Also clean the apt cache after installing packages. See the apt-get recommendations here.

build-essential \
git

RUN git clone git://github.com/cernekee/stoken
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https:// instead of git://?

@@ -0,0 +1,26 @@
## Build container
build:
@bash -x scripts/build.sh
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If build.sh is a one-liner, just inline it here.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I was kind of wondering if it is more common for Docker users to invoke make -C docker build, ./docker/scripts/build.sh, or something else.

For make -C docker run I would assume you'll want a way to pass arguments, so that the user can at least perform basic operations like importing a new token?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly I think it's more common for Docker users to run docker commands themselves. If I saw a Dockerfile in a project, it would be logical that I can simply do

docker build -t mytagname dir
docker run -it mytagname bash

I'm not sure these make targets or helper scripts provide much value.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In short, as a first step, I would probably just commit docker/Dockerfile and leave it at that. Most Docker users and tools know what to do with that.


## Run project
run:
@bash -x scripts/run.sh
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same, just inline the command here.

#!/bin/bash
set -ex

docker build -t stevemcquaid/stoken:latest .
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Obviously without your user name hard coded here.

@@ -0,0 +1,4 @@
#!/bin/bash

docker run -it -v $HOME:/root stevemcquaid/stoken:latest stoken $@
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same user name issue here.

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.

3 participants