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

As a user, I want Habushu to create a virtual environment that can run my python application within my docker container so I can easily containerize single habushu module #149

Closed
4 tasks done
csun-cpointe opened this issue Jun 20, 2024 · 3 comments
Assignees

Comments

@csun-cpointe
Copy link
Contributor

csun-cpointe commented Jun 20, 2024

Description

Follow on the Issue #146 , which all the single habushu module and its dependencies are copied to the build target directory, the Habushu will then work on the Dockerfile to resolve and export ONE virtual environment for the ONE monorepo dependency’s poetry project.

DOD

  • Insert the logic to the Dockerfile to build and export the virtual environment.
    • Optimize the build speed (potentially use cache)
    • Update Habushu ReadMe 
    • In the PR description, we should include a draft release note

BDD Scenario:

Scenario: One Habushu-type dependency is specified with Dockerfile updates enabled
Given a single Habushu-type dependency
And a dockerfile to update
When the stage-dependencies goal is executed
Then all the source code to build the dependency is staged in the build directory
And Dockerfile is updated to build a virtual environment for the dependency

Test Steps:

  1. OTS Only:
    Pull this forked branch and run mvn clean install

  2. Final Test Only:
    Pull the latest dev branch of the technology brewery habushu repo

  3. Run the following in the root mvn clean install -Pbootstrap

  4. Download the attached project
    example-monorepo.zip and unzip it

  5. Create a Dockerfile under example-monorepo/extensions/extensions-monorepo-dep-consuming-application/src/main/docker/Dockerfile directory with below content

#HABUSHU_BUILDER_STAGE

FROM redhat/ubi9-minimal:latest
RUN microdnf install -y python3.11

#HABUSHU_FINAL_STAGE

ENTRYPOINT ["/opt/venv/bin/python3.11", "-m", "pets.main", "--enable_docs_url", "True"]
  1. Run mvn clean install at the root of the unzipped project

  2. Verify example-monorepo/extensions/extensions-monorepo-dep-consuming-application/src/main/docker/Dockerfile has been updated.

  3. Run mvn clean install again at the root directory and verify the content is still the same

  4. Run cd extensions/extensions-monorepo-dep-consuming-application

  5. Run docker build -f src/main/docker/Dockerfile . -t example.docker

  6. Run docker run --rm --name example.docker example.docker

  7. Verify the dependency wheel file is created

I have 3 pets:
I am a mammal
A cat name: yellow
meow
I am a mammal
A dog name: white
woof
A bird name: blue
chirp
  1. update the Dockerfile with below content and repeat step 6-12.
FROM redhat/ubi9-minimal:latest
RUN microdnf install -y python3.11
ENTRYPOINT ["/opt/venv/bin/python3.11", "-m", "pets.main", "--enable_docs_url", "True"]
@csun-cpointe
Copy link
Contributor Author

DoD completed with @ewilkins-csi

@Cho-William
Copy link
Contributor

OTS completed!

csun-cpointe added a commit to Cho-William/habushu that referenced this issue Jun 25, 2024
csun-cpointe added a commit to Cho-William/habushu that referenced this issue Jun 25, 2024
csun-cpointe added a commit to Cho-William/habushu that referenced this issue Jun 26, 2024
csun-cpointe added a commit to Cho-William/habushu that referenced this issue Jun 26, 2024
csun-cpointe added a commit to Cho-William/habushu that referenced this issue Jun 26, 2024
csun-cpointe added a commit to Cho-William/habushu that referenced this issue Jun 26, 2024
csun-cpointe added a commit to Cho-William/habushu that referenced this issue Jun 26, 2024
ewilkins-csi added a commit that referenced this issue Jun 26, 2024
…update

#149 implement update dockerfile to create virtual environment
@ewilkins-csi
Copy link
Contributor

Final Test successful. ✅

Updated docker file 1
Screenshot 2024-06-26 at 8 38 56 PM

Docker container 1
Screenshot 2024-06-26 at 8 43 56 PM

Updated dockerfile 2
Screenshot 2024-06-26 at 8 49 50 PM

Docker container 2
Screenshot 2024-06-26 at 8 50 38 PM

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

No branches or pull requests

3 participants