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

feat: Add dockerfile for automated builds to dockerhub #165

Merged
merged 9 commits into from Oct 12, 2021

Conversation

sabotagebeats
Copy link
Contributor

@sabotagebeats sabotagebeats commented Sep 27, 2021

What I did

added dockerfile and updated readme to include information about dockerhub

fixes: #

How I did it

added dockerfile
updated readme

How to verify it

we will verify it in the integration

Checklist

  • Passes all linting checks (pre-commit and CI jobs)
  • New test cases have been added and are passing
  • Documentation has been updated
  • PR title follows Conventional Commit standard (will be automatically included in the changelog)

@sabotagebeats sabotagebeats changed the title Feature: Add dockerfile for automated builds to dockerhub Feat: Add dockerfile for automated builds to dockerhub Sep 27, 2021
@sabotagebeats sabotagebeats changed the title Feat: Add dockerfile for automated builds to dockerhub feat: Add dockerfile for automated builds to dockerhub Sep 27, 2021
dockerfile Outdated
@@ -0,0 +1,9 @@
FROM ubuntu:latest
RUN apt-get update && apt-get upgrade -y
RUN apt-get install python3-pip python3 python-is-python3 -y
Copy link
Member

Choose a reason for hiding this comment

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

Pin to Python 3.9

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@fubuloubu I am having a problem with pinning to 3.9 where it wants me to interactively choose timezone etc. I have pinned to 3.8 in the meantime.

Copy link
Member

Choose a reason for hiding this comment

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

Pinning 3.8 is great. Kind of wild to have to select a timezone, must be a way around that 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it has to do with tzdata which i think is a requirement in apt-get in python3.9

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ARG DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe/Moscow
RUN apt-get install -y tzdata

if we want to pin to 3.9

https://serverfault.com/questions/949991/how-to-install-tzdata-on-a-ubuntu-docker-image

dockerfile Outdated
@@ -0,0 +1,9 @@
FROM ubuntu:latest
Copy link
Contributor

Choose a reason for hiding this comment

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

Did you ever try this on alpine?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no I haven't built this on alpine yet

Copy link
Contributor Author

Choose a reason for hiding this comment

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

do you know if I can do this one after another in the dockerfile? do you know how I can make sure that each build is automatically tagged properly as ubuntu or apline in the dockerhub repo?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried to build with alpine and running into a lot of problems so I'm going to leave it as ubuntu for now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the build that isn't working for me:

FROM python:alpine3.13
RUN pip3 install --upgrade eth-ape
RUN ape plugins add ens --yes
RUN ape plugins add etherscan --yes
RUN ape plugins add infura --yes
RUN ape plugins add solidity --yes
RUN ape plugins add vyper --yes

Copy link
Contributor Author

Choose a reason for hiding this comment

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

when trying to use alpine, in addition to errors building wheels for cffi and maturin I get stuck in the build process on when it starts to try to download the wheels for urllib

    In file included from c/_cffi_backend.c:2:
    /usr/local/include/python3.9/Python.h:11:10: fatal error: limits.h: No such file or directory
       11 | #include <limits.h>
          |          ^~~~~~~~~~
    compilation terminated.
    error: command '/usr/bin/gcc' failed with exit code 1
    ----------------------------------------
    ERROR: Failed building wheel for cffi
    Running setup.py clean for cffi
      gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -DTHREAD_STACK_SIZE=0x100000 -fPIC -DUSE__THREAD -I/usr/include/ffi -I/usr/include/libffi -I/usr/local/include/python3.9 -c c/_cffi_backend.c -o build/temp.linux-x86_64-3.9/c/_cffi_backend.o
      In file included from c/_cffi_backend.c:2:
      /usr/local/include/python3.9/Python.h:11:10: fatal error: limits.h: No such file or directory
         11 | #include <limits.h>
            |          ^~~~~~~~~~
      compilation terminated.
      error: command '/usr/bin/gcc' failed with exit code 1
      ----------------------------------------
  ERROR: Command errored out with exit status 1: /usr/local/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-mye4g0pn/cffi_9920a769f1fa4e24918c148f798fa688/setup.py'"'"'; __file__='"'"'/tmp/pip-install-mye4g0pn/cffi_9920a769f1fa4e24918c148f798fa688/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-c9usrg37/install-record.txt --single-version-externally-managed --prefix /tmp/pip-build-env-afl4esu6/overlay --compile --install-headers /tmp/pip-build-env-afl4esu6/overlay/include/python3.9/cffi Check the logs for full command output.
  ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/cf/5a/25aeb636baeceab15c8e57e66b8aa930c011ec1c035f284170cacb05025e/PyNaCl-1.4.0.tar.gz#sha256=54e9a2c849c742006516ad56a88f5c74bf2ce92c9f67435187c3c5953b346505 (from https://pypi.org/simple/pynacl/) (requires-python:>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*). Command errored out with exit status 1: /usr/local/bin/python /tmp/pip-standalone-pip-zminvb6v/__env_pip__.zip/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-afl4esu6/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'setuptools>=40.8.0' wheel 'cffi>=1.4.1; python_implementation != '"'"'PyPy'"'"'' Check the logs for full command output.
Collecting web3[tester]<6.0.0,>=5.18.0
  Downloading web3-5.23.1-py3-none-any.whl (486 kB)
  Downloading web3-5.23.0-py3-none-any.whl (485 kB)
Collecting ipfshttpclient==0.7.0
  Downloading ipfshttpclient-0.7.0-py3-none-any.whl (82 kB)
Collecting web3[tester]<6.0.0,>=5.18.0
  Downloading web3-5.22.0-py3-none-any.whl (484 kB)
  Downloading web3-5.21.0-py3-none-any.whl (482 kB)
  Downloading web3-5.20.1-py3-none-any.whl (479 kB)
  Downloading web3-5.20.0-py3-none-any.whl (480 kB)
Collecting websockets<9.0.0,>=8.1.0
    RuntimeError: cargo not found in PATH. Please install rust (https://www.rust-lang.org/tools/install) and try again
    ----------------------------------------
    ERROR: Failed building wheel for maturin
  Failed to build maturin
  ERROR: Could not build wheels for maturin which use PEP 517 and cannot be installed directly
      File "setup.py", line 58, in run
        raise RuntimeError(
    RuntimeError: cargo not found in PATH. Please install rust (https://www.rust-lang.org/tools/install) and try again
    ----------------------------------------
    ERROR: Failed building wheel for maturin
  Failed to build maturin
  ERROR: Could not build wheels for maturin which use PEP 517 and cannot be installed directly

  Downloading urllib3-1.26.5-py2.py3-none-any.whl (138 kB)
  Downloading urllib3-1.26.4-py2.py3-none-any.whl (153 kB)
  Downloading urllib3-1.26.3-py2.py3-none-any.whl (137 kB)
  Downloading urllib3-1.26.2-py2.py3-none-any.whl (136 kB)
  Downloading urllib3-1.26.1-py2.py3-none-any.whl (136 kB)
  Downloading urllib3-1.26.0-py2.py3-none-any.whl (136 kB)
INFO: pip is looking at multiple versions of urllib3 to determine which version is compatible with other requirements. This could take a while.
  Downloading urllib3-1.25.11-py2.py3-none-any.whl (127 kB)
  Downloading urllib3-1.25.10-py2.py3-none-any.whl (127 kB)
  Downloading urllib3-1.25.9-py2.py3-none-any.whl (126 kB)
  Downloading urllib3-1.25.8-py2.py3-none-any.whl (125 kB)
  Downloading urllib3-1.25.7-py2.py3-none-any.whl (125 kB)
INFO: This is taking longer than usual. You might need to provide the dependency resolver with stricter constraints to reduce runtime. If you want to abort this run, you can press Ctrl + C to do so. To improve how pip performs, tell us what happened here: https://pip.pypa.io/surveys/backtracking
  Downloading urllib3-1.25.6-py2.py3-none-any.whl (125 kB)
  Downloading urllib3-1.25.5-py2.py3-none-any.whl (125 kB)
  Downloading urllib3-1.25.4-py2.py3-none-any.whl (125 kB)
  Downloading urllib3-1.25.3-py2.py3-none-any.whl (150 kB)
  Downloading urllib3-1.25.2-py2.py3-none-any.whl (150 kB)
  Downloading urllib3-1.24.3-py2.py3-none-any.whl (118 kB)
  Downloading urllib3-1.24.2-py2.py3-none-any.whl (131 kB)
  Downloading urllib3-1.24.1-py2.py3-none-any.whl (118 kB)
  Downloading urllib3-1.24-py2.py3-none-any.whl (117 kB)
  Downloading urllib3-1.23-py2.py3-none-any.whl (133 kB)
  Downloading urllib3-1.22-py2.py3-none-any.whl (132 kB)
  Downloading urllib3-1.21.1-py2.py3-none-any.whl (131 kB)

Copy link
Member

Choose a reason for hiding this comment

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

Skipping Alpine for now

Dockerfile Outdated
RUN apt-get update && apt-get upgrade -y
RUN apt-get install python3-pip python3 python-is-python3 -y
RUN pip install --upgrade eth-ape
RUN ape plugins add ens -y
Copy link
Contributor

Choose a reason for hiding this comment

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

For scripts, it is generally more readable to use the longer option names, such as --yes in this case instead of -y. Shorthand options are great for adhoc, long-hand options are great for scripts.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll make the requested changes for this. I also I got an email with your note about docker compose, not sure where that comment went, but would love to chat with you about this, maybe at Wednesday meeting.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah yeah, the docker-compose thing might be more complicated than I though. It might make sense for ape plugin dependencies though, like running the hardhat network.

Another usability for ape would be to copy other package managers and allow multiple args for the plugins when adding. That way, you can just do:

ape plugins add ens etherscan infura solidity 

and it will install all 4.

Copy link
Contributor

@antazoey antazoey Sep 28, 2021

Choose a reason for hiding this comment

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

One thing we can do is create a build_ape.sh script that takes parameters such as which plugins to use. Or maybe it figures it out other ways. Either way, this script can be copied in the container and ran with parameters set from environment variables e.g. --build-arg ARG_NAME=ARG_VALUE


Edit: This will require more thought, I am just trying to think of how to make the containerizing ape more customizable. I think docker-compose will not necessarily solve this on its own. However, I sometimes prefer having compose files because they are easier to start up and tweak and sometimes I just want to run everything with a simple command.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes I believe the reason we went with dockerfile and not compose is that we didn't want to have it spinning up an app, we wanted it to be a CLI command. I do have a compose file that I have not committed, but we are not using it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@sabotagebeats
Copy link
Contributor Author

Should I add docker build to testing for this?

@sabotagebeats sabotagebeats mentioned this pull request Sep 28, 2021
RUN ape plugins add etherscan --yes
RUN ape plugins add infura --yes
RUN ape plugins add solidity --yes
RUN ape plugins add vyper --yes
Copy link
Contributor

@antazoey antazoey Sep 28, 2021

Choose a reason for hiding this comment

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

A lot of CLI Dockerfiles I see use ENTRYPOINT so it is like running ape when you run the container, which means if you don't give it commands, it just prints the help and exits... I think you mentioned you looked into this pattern, but just thought I'd say that it is common from what I have seen. How much have we considered this approach?

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Notice it builds uses alpine, uses geth command as the entrypoint, and it builds from source!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I haven't used ENTRYPOINT before however I want to make sure that we can do other CLI stuff other than just running ape console for example ape accounts and ape compile etc

Copy link
Contributor

Choose a reason for hiding this comment

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

It would be what ever command the user types in!

They would run the container with the same args that they run ape with. So if they run the container with console as the argument, it would launch a console, etc.

Copy link
Contributor

@antazoey antazoey Sep 28, 2021

Choose a reason for hiding this comment

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

Like this docker run apeworx/ape console

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It would be what ever command the user types in!
They would run the container with the same args that they run ape with. So if they run the container with console as the argument, it would launch a console, etc.

yes then the problem here then becomes that they can't do other things if they need to with the cli within that image, right?

Dockerfile Outdated
FROM ubuntu:20.04
RUN apt-get update && apt-get upgrade --yes
RUN apt-get install python3-pip python3.8 --yes
RUN pip3 install --upgrade eth-ape
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm.... I'd actually expect this to build from source. That way, you download the repo and can build the container for dev purposes

Copy link
Contributor Author

Choose a reason for hiding this comment

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

so like this?

RUN git clone https://github.com/ApeWorX/ape
RUN pip3 install -e ./ape

Copy link
Contributor

Choose a reason for hiding this comment

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

I was thinking something like python setup.py sdist and then pip install dist/eth-ape* since this Dockerfile is in the same repo.

From CI/CD perspective, if we want to run a job to deploy the image to Dockerhub on release, there might be a race condition if relying on the build being available on pypi first

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh youd have to copy the source files to the container as well as use a .dockerignore

Copy link
Contributor

Choose a reason for hiding this comment

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

Lol maybe git is better.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was testing this with git and i'm having a bunch of failures. I'll keep trying and post the failures if i can't git it to work

Copy link
Contributor Author

Choose a reason for hiding this comment

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

as per conversation with @fubuloubu:
copy the files from the local directory into the docker image and then use pip install
benefit: not relying on deployed version, it will be whatever is on the master branch and be easier to debug and avoid race condition

Copy link

Choose a reason for hiding this comment

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

I would agree with copying files from local directory as that is also easiest to build for the purposes of development and testing new features on a local instance via a built image.

Copy link
Contributor

@antazoey antazoey left a comment

Choose a reason for hiding this comment

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

I might have approved too early, I think there is some more to figure out.
The main thing, I think, is to not build from pypi but to use the source files. Additionally, I think it is best to have the container function the exact same as the CLI tool itself, so running the container should exit immediately and it should use the simple ape as its ENTRYPOINT. It might take some figuring out. Finally, we should try to use alpine to cut the cruft of the image. This should be able to build fast!

@sabotagebeats
Copy link
Contributor Author

I might have approved too early, I think there is some more to figure out. The main thing, I think, is to not build from pypi but to use the source files. Additionally, I think it is best to have the container function the exact same as the CLI tool itself, so running the container should exit immediately and it should use the simple ape as its ENTRYPOINT. It might take some figuring out. Finally, we should try to use alpine to cut the cruft of the image. This should be able to build fast!

ape as an entry point then the user can't do other things if they need to with the cli within that image, right? Not sure if this is a problem or not.

I wasn't able to successfully get alpine to build unfortunately. There are many dependency errors and issues with pip install.

@sabotagebeats
Copy link
Contributor Author

This article is why I originally decided to go with Ubuntu as a base image.

https://megamorf.gitlab.io/2020/05/06/why-it-s-better-not-to-use-alpine-linux-for-python-projects/

@sabotagebeats
Copy link
Contributor Author

This article details why I'm running into errors trying to build with alpine: https://pythonspeed.com/articles/alpine-docker-python/

@sabotagebeats
Copy link
Contributor Author

This article details why I'm running into errors trying to build with alpine: https://pythonspeed.com/articles/alpine-docker-python/

as per this article I tried to reduce the build size by using python:3.8-slim however then I came into a bunch of errors with unable to execute 'gcc': No such file or directory:

  unable to execute 'gcc': No such file or directory
  error: command 'gcc' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for bitarray
  unable to execute 'gcc': No such file or directory
  error: command 'gcc' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for lru-dict
  unable to execute 'gcc': No such file or directory
  error: command 'gcc' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for pyethash
  unable to execute 'gcc': No such file or directory
  error: command 'gcc' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for pysha3

@antazoey antazoey marked this pull request as draft September 28, 2021 17:11
@antazoey antazoey marked this pull request as ready for review September 28, 2021 17:11
@antazoey
Copy link
Contributor

This article is why I originally decided to go with Ubuntu as a base image.

https://megamorf.gitlab.io/2020/05/06/why-it-s-better-not-to-use-alpine-linux-for-python-projects/

Ok, that makes sense! Ubuntu works.

@antazoey
Copy link
Contributor

antazoey commented Sep 28, 2021

I might have approved too early, I think there is some more to figure out. The main thing, I think, is to not build from pypi but to use the source files. Additionally, I think it is best to have the container function the exact same as the CLI tool itself, so running the container should exit immediately and it should use the simple ape as its ENTRYPOINT. It might take some figuring out. Finally, we should try to use alpine to cut the cruft of the image. This should be able to build fast!

ape as an entry point then the user can't do other things if they need to with the cli within that image, right? Not sure if this is a problem or not.

I wasn't able to successfully get alpine to build unfortunately. There are many dependency errors and issues with pip install.

Correct, they wouldn't be able to do anything that is not an ape command.
Maybe we don't want that, maybe that is too limiting.. It is just what I see most CLI tools do for their Dockerfiles, so we should at least consider it.


Edit:
The reason for this is have the container be the same as the service we are offering.

@sabotagebeats
Copy link
Contributor Author

todo:
entrypoints and source code copy

skip for now:
alpine and 3.8 slim

@sabotagebeats
Copy link
Contributor Author

sabotagebeats commented Oct 4, 2021

source code copying is working except that installing vyper step is failing.

$3aa926e91d69 ape plugins list
WARNING: Error loading plugin package 'ape_vyper'
WARNING: $GITHUB_ACCESS_TOKEN not set, skipping 2nd class plugins
Installed plugins:
  ape_ens (0.1.0a1)
  ape_etherscan (0.1.0a1)
  ape_infura (0.1.0a2)
  ape_solidity (0.1.0a2)

then when I go to compile docker

$3aa926e91d69 ape compile
WARNING: Error loading plugin package 'ape_vyper'
WARNING: No compilers detected for the following extensions: .vy

@fubuloubu
Copy link
Member

@sabotagebeats that warning pops up when the plugin isn't currently functioning properly. Try debugging it locally, and then fixing the ape-vyper plugin

@sabotagebeats
Copy link
Contributor Author

this is a preexisting issue: ApeWorX/ape-vyper#22

@fubuloubu
Copy link
Member

@sabotagebeats yes, so the solution to that issue will solve this one and allow the plugin to function in the image. However we should take this oppurtunity to think through how the image is built here, and make sure that all plugins are functioning for when we distribute the image.

Perhaps this needs to be "tested" in the image by making sure that ape plugins has no warnings. WIll have to think more on this one.

@sabotagebeats
Copy link
Contributor Author

Perhaps this needs to be "tested" in the image by making sure that ape plugins has no warnings. WIll have to think more on this one.

yes maybe we can do build testing for compilation functionality of the docker image?

@sabotagebeats sabotagebeats self-assigned this Oct 4, 2021
@antazoey
Copy link
Contributor

antazoey commented Oct 5, 2021

It should be pretty straight forward to upgrade the vyper plugin. Let me know if not!
I was going to upgrade all the plugins probably after the next alpha release as the CLI SDK work is wrapping up.

@sabotagebeats
Copy link
Contributor Author

$ docker build .
Sending build context to Docker daemon  16.12MB
Step 1/10 : FROM ubuntu:latest
 ---> 597ce1600cf4
Step 2/10 : RUN apt-get update && apt-get upgrade --yes && apt-get install git python3.8 python3-pip python3-dev --yes
 ---> Using cache
 ---> 676ae34f4e32
Step 3/10 : COPY ./src ./setup.py ./README.md ./pyproject.toml ./setup.cfg ./
 ---> 82edcc2114b7
Step 4/10 : RUN python3 ./setup.py install
 ---> Running in 79fdd6aa6e4a
Traceback (most recent call last):
  File "./setup.py", line 54, in <module>
    setup(
  File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 144, in setup
    return distutils.core.setup(**attrs)
  File "/usr/lib/python3.8/distutils/core.py", line 108, in setup
    _setup_distribution = dist = klass(attrs)
  File "/usr/lib/python3/dist-packages/setuptools/dist.py", line 447, in __init__
    _Distribution.__init__(self, {
  File "/usr/lib/python3.8/distutils/dist.py", line 292, in __init__
    self.finalize_options()
  File "/usr/lib/python3/dist-packages/setuptools/dist.py", line 740, in finalize_options
    ep.load()(self)
  File "/.eggs/setuptools_scm-6.3.2-py3.8.egg/setuptools_scm/integration.py", line 94, in infer_version
    dist.metadata.version = _get_version(config)
  File "/.eggs/setuptools_scm-6.3.2-py3.8.egg/setuptools_scm/__init__.py", line 177, in _get_version
    parsed_version = _do_parse(config)
  File "/.eggs/setuptools_scm-6.3.2-py3.8.egg/setuptools_scm/__init__.py", line 135, in _do_parse
    raise LookupError(
LookupError: setuptools-scm was unable to detect version for '/'.

Make sure you're either building from a fully intact git repository or PyPI tarballs. Most other sources (such as GitHub's tarballs, a git checkout without the .git folder) don't contain the necessary metadata and will not work.

For example, if you're using pip, instead of https://github.com/user/proj/archive/master.zip use git+https://github.com/user/proj.git#egg=proj
The command '/bin/sh -c python3 ./setup.py install' returned a non-zero code: 1

@fubuloubu
Copy link
Member

@sabotagebeats build it locally first, and the move the version.py file over to the image as well, this is generated by setuptools-scm from your git repo during installation.

@sabotagebeats
Copy link
Contributor Author

@sabotagebeats build it locally first, and the move the version.py file over to the image as well, this is generated by setuptools-scm from your git repo during installation.

So I did try to build this locally but I don't have the version.py file. Maybe I'm doing something wrong? It works if I copy the entire directory.

@fubuloubu
Copy link
Member

@sabotagebeats build it locally first, and the move the version.py file over to the image as well, this is generated by setuptools-scm from your git repo during installation.

So I did try to build this locally but I don't have the version.py file. Maybe I'm doing something wrong? It works if I copy the entire directory.

the .git folder is what's needed, which if you don't copy all the files it will install as "dirty" because some of the files are gone

let's stick with copying everything over.can always fix it

@sabotagebeats
Copy link
Contributor Author

When the vyper contracts and solidity contractts are combined in the same folder:

$ docker run -i --volume $HOME/.ape:/root/ape --volume $HOME/.vvm:/root/.vvm --volume $HOME/.solcx:/root/.solcx --volume $PWD:/root/project --workdir /root/project 6d7d5e402808 compile
INFO: Compiling 'contracts/Token.vy'
INFO: Compiling 'contracts/Token.sol'
INFO: Compiling 'contracts/SafeMath.sol'
ERROR: ContractType collision across compiler plugins

this causes the contracts not to compile

@sabotagebeats
Copy link
Contributor Author

sabotagebeats commented Oct 7, 2021

(apeworx) sabotage@sabotage:~/ape/mixed-token$ ape compile
INFO: Compiling 'contracts/Token.sol'
INFO: Compiling 'contracts/SafeMath.sol'
INFO: Compiling 'contracts/Token.vy'
ERROR: ContractType collision across compiler plugins
(apeworx) sabotage@sabotage:~/ape/mixed-token$ ape --version
0.1.0a25.dev1+ga7ef8ec
(apeworx) sabotage@sabotage:~/ape/mixed-token$ ape plugins list
Installed plugins:
  ape_infura (0.1.0a1)
  ape_trezor
  ape_solidity (0.1.0a3.dev0+g3ea4255.d20211005)
  ape_vyper (0.1.0a7.dev1+gcc2efe6)

this is happening in 0.1.0a25, I'm going to go ahead and test it in 0.1.0a23

@sabotagebeats
Copy link
Contributor Author

filed issue #178

@fubuloubu
Copy link
Member

filed issue #178

See response (and closure) e.g. just change to VyperToken.vy and it should compile

@antazoey
Copy link
Contributor

antazoey commented Oct 8, 2021

@sabotagebeats build it locally first, and the move the version.py file over to the image as well, this is generated by setuptools-scm from your git repo during installation.

So I did try to build this locally but I don't have the version.py file. Maybe I'm doing something wrong? It works if I copy the entire directory.

the .git folder is what's needed, which if you don't copy all the files it will install as "dirty" because some of the files are gone

let's stick with copying everything over.can always fix it

You should be able to bind it during the install command, e.g. RUN --mount=source=.git,target=.git,type=bind python3 ./setup.py install

@sabotagebeats
Copy link
Contributor Author

i had removed git from the apt-get install and it broke the build so i put it back

@fubuloubu
Copy link
Member

fubuloubu commented Oct 8, 2021

i had removed git from the apt-get install and it broke the build so i put it back

This makes sense, setuptools_scm needs it to query the version from git

@sabotagebeats
Copy link
Contributor Author

Hmm, I did not mess with the files that are failing the type check, and I tried to merge upstream/main but still failing.

@sabotagebeats
Copy link
Contributor Author

looks like merging main fixed the types issue :)

@fubuloubu
Copy link
Member

looks like merging main fixed the types issue :)

Is this good to merge and see how docker hub takes it?

@sabotagebeats
Copy link
Contributor Author

looks like merging main fixed the types issue :)

Is this good to merge and see how docker hub takes it?

yes I believe we can merge this and then I can review the integration to make sure it was successful.

@sabotagebeats sabotagebeats merged commit 1edcc2d into ApeWorX:main Oct 12, 2021
@sabotagebeats sabotagebeats deleted the feat/docker branch October 12, 2021 03:00
@sabotagebeats
Copy link
Contributor Author

this is building properly on dockerhub @fubuloubu @unparalleled-js
It is building immediately and not on version upgrade. Should we build every time a commit is merged, or should we build every time the version is updated?

@fubuloubu
Copy link
Member

latest should be building every time
stable and the tagged versions should only build on new version tags

I think this happened today because we did 0.1.1 by accident, and Docker also caught it

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.

None yet

4 participants