Skip to content

Add Dockerfile for grumpy - #151

Open
abitrolly wants to merge 7 commits into
grumpyhome:masterfrom
abitrolly:dockerizing
Open

Add Dockerfile for grumpy#151
abitrolly wants to merge 7 commits into
grumpyhome:masterfrom
abitrolly:dockerizing

Conversation

@abitrolly

@abitrolly abitrolly commented Jun 9, 2020

Copy link
Copy Markdown

It is Ubuntu 20.04 with Python 2. Still not clear
how to run grumpy directly from source.

/app/grumpy-tools-src# python2 grumpy_tools
/usr/bin/python2: can't find '__main__' module in 'grumpy_tools'

Need some helper scripts.


Test that the image works.

docker run -it yakshaveinc/grumpy
@alanjds

alanjds commented Jun 9, 2020

Copy link
Copy Markdown

You can take a look on the .travis.yaml describing the CI test.

You may need to run the following lines on the Dockerfile to produce a working image:

grumpy/.travis.yml

Lines 28 to 52 in 9c8d500

install:
- |
export GOPATH=~/gopath
export PATH="$GOPATH/bin:$PATH"
export TRAVIS_BUILD_DIR="$GOPATH/src/github.com/$TRAVIS_REPO_SLUG"
mkdir -p "$TRAVIS_BUILD_DIR"
rsync -az . "$TRAVIS_BUILD_DIR"
cd "$TRAVIS_BUILD_DIR"
# Use the current gimme because Travis gimme does not support syntax "1.10.x" and "stable"
eval "$(curl -sL https://raw.githubusercontent.com/travis-ci/gimme/master/gimme | GIMME_GO_VERSION=${GO} bash)"
before_script:
- go version && python --version && python -m pip --version
# https://github.com/travis-ci/travis-ci/issues/8920#issuecomment-352661024
- python -c "import fcntl; fcntl.fcntl(1, fcntl.F_SETFL, 0)"
- pip install --upgrade pip
- pip install 'pytest==3.8.1' 'pytest-cov==2.6.0'
script:
# Install the thing
- cd grumpy-tools-src
- pip install .
- which grumpy
- cd ../grumpy-runtime-src
- pip install .

After that, the grumpy command will be available. Then you may want to put it on the ENTRYPOINT Dockerfile statement.

@abitrolly

Copy link
Copy Markdown
Author

I see there is only one script in grumpy-tools-src. Maybe rename the dir to grumpy-cli?

@alanjds

alanjds commented Jun 12, 2020

Copy link
Copy Markdown

This could be done the two packages got independent. But they are coupled to a point that a split CI seemed not wise at the time. Having such names was the way I got to be able to use a monorepo for both packages.

The proposed change will lead to deep changes on the package management & CI involving makefiles and Golang compilation. I do not recommend doing so, but feel free to mark me for code review or ask for references on setuptools internals :)

@abitrolly

Copy link
Copy Markdown
Author

@alanjds the directory structure already diverged between two grumpyhome and google. A circular dependency between cli and libs of grumpy doesn't looks like a good thing to me.

@abitrolly

abitrolly commented Jun 16, 2020

Copy link
Copy Markdown
Author

Saving commands I use to build the image.

podman build -t grumpy .

podman tag grumpy docker.io/yakshaveinc/grumpy
podman push --creds "$(pass yakshaveinc/docker | tr ' ' ':')" docker.io/yakshaveinc/grumpy:latest

podman run -it yakshaveinc/grumpy
@abitrolly

Copy link
Copy Markdown
Author

At least grumpy-tools doesn't need grumpy-runtime for the installation.

✗ podman run -it yakshaveinc/grumpy grumpy
Error: Could not found the Grumpy Runtime 'data/gopath' resource.
Is 'grumpy-runtime' package installed?
@abitrolly

Copy link
Copy Markdown
Author

Everything installs without error, but running fails.

# grumpy -c 'print("hello")'
/tmp/tmptxtN5t__pycache__/gopath/src/__python__/main.go:6:2: cannot find package "__python__/__go__/grumpy" in any of:
	/usr/lib/go-1.13/src/__python__/__go__/grumpy (from $GOROOT)
	/tmp/tmptxtN5t__pycache__/gopath/src/__python__/__go__/grumpy (from $GOPATH)
	/app/grumpy-runtime-src/grumpy_runtime/data/gopath/src/__python__/__go__/grumpy
@abitrolly

Copy link
Copy Markdown
Author

@alanjds pushed latest version to Docker Hub. Should work now.

It is Ubuntu 20.04 with Python 2. Still not clear
how to run `grumpy` directly from source.

  /app/grumpy-tools-src# python2 grumpy_tools
  /usr/bin/python2: can't find '__main__' module in 'grumpy_tools'

Need some helper scripts.
Python 2 `pip` is not packaged for 20.04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants