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

Add Dockerfile for grumpy #151

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

abitrolly
Copy link

@abitrolly abitrolly commented Jun 9, 2020

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
Copy link

alanjds commented Jun 9, 2020

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
Author

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

@alanjds
Copy link

alanjds commented Jun 12, 2020

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
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
Copy link
Author

abitrolly commented Jun 16, 2020

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
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
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
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants