dsfai2020 / Task-and-Nutrition-Manager

An agile planning application that tracks tasks, ideas and nutrition goals. This app is designed to assist with everyday productivity, progress tracking and fitness.
1 stars 0 forks source link

Run a smoke test on Docker/Jenkins using a basic pytest on windows #43

Closed dsfai2020 closed 4 months ago

dsfai2020 commented 1 year ago

This process is to take place on Windows 10 using Docker. While also having Jenkins installed on a container that not only runs, but supports pytest from within docker as well.

ON WINDOWS 10

ON JENKINS/DOCKER

Failure in any of these areas results in a non completion.

dsfai2020 commented 1 year ago

Ran into a couple issues on Windows 10.

Apt-get won't even work at the moment. Tried configuring it through the docker terminal and ran into a dead end. Permission was denied. Sudo as well.

As it stands, The docker image works. Jenkins runs on the local ports it makes. It supports Debian but it just doesn't seem to come pre configured with python.

dsfai2020 commented 1 year ago

https://docs.docker.com/get-started/07_multi_container/

Here's a lead.

NETWORKING CONTAINERS "So, how do you allow one container to talk to another? The answer is networking. If you place the two containers on the same network, they can talk to each other."

dsfai2020 commented 1 year ago

Python lead for docker here. (You'll need it for pytest in Jenkins and eventually you'll need it for dev servers on the backend.

https://docs.docker.com/language/python/build-images/

dsfai2020 commented 1 year ago

powershell needed a local python interpreter so I downloaded one from the store windows store to simplify the process on Windows.

image

image

Ran into a new issue where python isn't being detected on the PATH for Windows powershell OR command prompt.

dsfai2020 commented 1 year ago

powershell needed a local python interpreter so I downloaded one from the store windows store to simplify the process on Windows.

image

image

Ran into a new issue where python isn't being detected on the PATH for Windows powershell OR command prompt.

https://stackoverflow.com/questions/58754860/cmd-opens-windows-store-when-i-type-python

I had to go into the env settings and move the directory that houses the windows apps (since it was from the store) to the top of the list. I did this for both local and global. Then I went into the Alias page and disabled and re-enabled the windowed mode and regular mode pythons. This fixed the problem.

dsfai2020 commented 1 year ago

Now that python is working run these commands to get the venv up and running.

python -m venv nameofenv nameofenv\Scripts\activate

Resuming steps for the python Docker setup at https://docs.docker.com/language/python/build-images/

image

image

dsfai2020 commented 1 year ago

Ran into an issue where docker wouldn't build on powershell because the Docker Daemon wasn't running. To resolve this I'll attempt to run powershell as Admin.

powershell, command terminal, and vscode terminal are all throwing the same error regardless of admin rights.

image

This happens if I put in docker build or docker build --tag python-docker

DO NOT FORGET THE PERIOD at the end of docker build .

image

Running the command without a tag created a nameless container

image

But running it with the tag as follows gave it a name.

docker build --tag python-docker .

image

Now the name displays.

image

Now the image displays on Docker Desktop as well.

image

dsfai2020 commented 1 year ago

This concludes https://docs.docker.com/language/python/build-images/

Next up is:

https://docs.docker.com/language/python/run-containers/