Closed sjortiz closed 5 years ago
@sjortiz is there any way to update the .travis.yml file to run the tests inside the Docker container?
yes, there is but it will add extra size to docker, I specifically ignored the tests folder in the copy command
Got it! So I think Laravel tests should be removed from the .travis.yml
and then change the file to match the same environment of the Docker container. Is that possible?
@sjortiz I sent you an email, please confirm the information. Thanks!
@davidtavarez are test test failing because of my latest changes? I'm not following the following statement:
change the file to match the same environment of the Docker container. Is that possible?
could you rephrase?
If you can notice in the .travis.yml
we have 2 groups of tests: Laravel on PHP 7.2
and Flask on Python 3.7
. The Laravel tests are failing.
We can remove the Laravel on PHP 7.2
tests from this repo since the Laravel code will be at the @nromero125's fork.
The Travis CI runs the tests under xenial
but the Docker Container runs under alpine
. I think both environments should have the same SO: alpine
.
@sjortiz I was investigating a little bit more and I was wrong. If you're able to match the SO is fine but not necessary.
In fact, due to the project structure, the pip install
command won't run in alpine
, it will fail with the following error:
Collecting psycopg2==2.7.6.1 (from -r requirements.txt (line 22))
Downloading https://files.pythonhosted.org/packages/c0/07/93573b97ed61b6fb907c8439bf58f09957564cf7c39612cef36c547e68c6/psycopg2-2.7.6.1.tar.gz (427kB)
Complete output from command python setup.py egg_info:
running egg_info
creating pip-egg-info/psycopg2.egg-info
writing pip-egg-info/psycopg2.egg-info/PKG-INFO
writing dependency_links to pip-egg-info/psycopg2.egg-info/dependency_links.txt
writing top-level names to pip-egg-info/psycopg2.egg-info/top_level.txt
writing manifest file 'pip-egg-info/psycopg2.egg-info/SOURCES.txt'
Error: pg_config executable not found.
pg_config is required to build psycopg2 from source. Please add the directory
containing pg_config to the $PATH or specify the full executable path with the
option:
python setup.py build_ext --pg-config /path/to/pg_config build ...
or with the pg_config option in 'setup.cfg'.
If you prefer to avoid building psycopg2 from source, please install the PyPI
'psycopg2-binary' package instead.
For further information please check the 'doc/src/install.rst' file (also at
<http://initd.org/psycopg/docs/install.html>).
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-3vb8dr89/psycopg2/
That's why I had to made the trick of building on the full image and then copying over the dependencies, I'll proceed and remove the laravel part from the .yml
make sense!
Description
This PR aims to dockerize the python api by doing the following adjustments:
Adds a multi stage
Dockerfile
, meaning that thisDockerfile
is comprised of multi parts (the first one that builds the dependencies, another that copies that dependencies and run the app)Modifies the
app.run
command insrc/python3/run.py
to make it listen to all the interfaces by specifying the host as0.0.0.0
Adds the
Dockerfile
to the.dockerignore
so its changes don't lost the cache after the copy commandAdds the
migrations
folder to the .dockerignore so it doesn't get copy over as it needs to be deleted anywayAdds the
tests
folder to the.dockerignore
so it doesn't get copy over as it's not used in the docker setupFixes
Fixes #57