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 #127

Merged
merged 9 commits into from
Nov 21, 2024
Merged

Add dockerfile #127

merged 9 commits into from
Nov 21, 2024

Conversation

henrikstranneheim
Copy link
Contributor

@henrikstranneheim henrikstranneheim commented Nov 6, 2024

Description

This PR adds/fixes ...

How to prepare for test

  • ssh to hasta.scilifelab.se
  • Use stage: us
  • Paxa the environment: paxa
  • Install on stage (example for hasta):
    bash /home/proj/production/servers/resources/hasta.scilifelab.se/update-tool-stage.sh -e S_hermes -t hermes -b [THIS-BRANCH-NAME]

How to test

  • Do ...

Expected test outcome

  • Check that ...
  • Take a screenshot and attach or copy/paste the output.

Review

  • Tests executed by
  • "Merge and deploy" approved by
    Thanks for filling in who performed the code review and the test!

This version is a

  • MAJOR - when you make incompatible API changes
  • MINOR - when you add functionality in a backwards compatible manner
  • PATCH - when you make backwards compatible bug fixes or documentation/instructions

Implementation Plan

  • Document in ...
  • Deploy this branch
  • Inform to ...

@codecov-commenter
Copy link

codecov-commenter commented Nov 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.83%. Comparing base (54ae97a) to head (8e69019).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #127   +/-   ##
=======================================
  Coverage   92.83%   92.83%           
=======================================
  Files          28       28           
  Lines         977      977           
=======================================
  Hits          907      907           
  Misses         70       70           
Flag Coverage Δ
unittests 92.83% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

@henrikstranneheim
Copy link
Contributor Author

Test docker 👍

[henrik.stranneheim@hasta:~] [S_base] $ source /home/proj/stage/servers/config/hasta.scilifelab.se/bashrc
[henrik.stranneheim@hasta:~] [base] $ hermes-test-deploy add-dockerfile
Pulling image for feature branch: add-dockerfile...
WARNING: Authentication token file not found : Only pulls of public images will succeed
INFO:    Starting build...
Getting image source signatures
Copying blob sha256:6dce3b49cfe6dc4b4e0198412bb0578215c86dae41303c47438639853bcba562
 29.97 MiB / 29.97 MiB [====================================================] 0s
Copying blob sha256:8d4dbf8eff6fce7ec6521dea8ec5c57f82c08ca4d8c18f0695aab0f65a96a6e7
 1.03 MiB / 1.03 MiB [======================================================] 0s
Copying blob sha256:f5d1f35bbc6281a31f145940d8353bf0f9f615c5c867101bf44eae6da8861e7a
 12.31 MiB / 12.31 MiB [====================================================] 0s
Copying blob sha256:6821d50670bb17bbbd7d33ad2a15dbc106d3ab46ae6d211795d98e7c7ee2a543
 249 B / 249 B [============================================================] 0s
Copying blob sha256:2aa3976fbd991c705f357e4ea99b303cca0bd66dc79bb8f8094a8cb3928af22b
 93 B / 93 B [==============================================================] 0s
Copying blob sha256:c7d48191456563a0366a507c392e541bc69f7f26566c61cd003e5b1d57f17405
 195.79 KiB / 195.79 KiB [==================================================] 0s
Copying blob sha256:60a5b41e7135ae36a0b61069141c69909cdcc7616e38fb25b38fb08fd87d8b3b
 51.79 MiB / 51.79 MiB [====================================================] 1s
Copying config sha256:1a68e107a16ec4c8b2cf32787ed93b39d933a41547f18127328d47e03ba0b3a7
 6.04 KiB / 6.04 KiB [======================================================] 0s
Writing manifest to image destination
Storing signatures
INFO:    Creating SIF file...
INFO:    Build complete: /home/proj/stage/singularity_containers/hermes_add-dockerfile.sif
You can now run 'hermes-test --help' to test the feature branch: add-dockerfile.
[henrik.stranneheim@hasta:~] [base] $ hermes-test --help
INFO:    Converting OCI blobs to SIF format
INFO:    Starting build...
Getting image source signatures
Skipping fetch of repeat blob sha256:6dce3b49cfe6dc4b4e0198412bb0578215c86dae41303c47438639853bcba562
Skipping fetch of repeat blob sha256:8d4dbf8eff6fce7ec6521dea8ec5c57f82c08ca4d8c18f0695aab0f65a96a6e7
Skipping fetch of repeat blob sha256:f5d1f35bbc6281a31f145940d8353bf0f9f615c5c867101bf44eae6da8861e7a
Skipping fetch of repeat blob sha256:6821d50670bb17bbbd7d33ad2a15dbc106d3ab46ae6d211795d98e7c7ee2a543
Skipping fetch of repeat blob sha256:2aa3976fbd991c705f357e4ea99b303cca0bd66dc79bb8f8094a8cb3928af22b
Skipping fetch of repeat blob sha256:c7d48191456563a0366a507c392e541bc69f7f26566c61cd003e5b1d57f17405
Skipping fetch of repeat blob sha256:60a5b41e7135ae36a0b61069141c69909cdcc7616e38fb25b38fb08fd87d8b3b
Copying config sha256:1a68e107a16ec4c8b2cf32787ed93b39d933a41547f18127328d47e03ba0b3a7
 6.04 KiB / 6.04 KiB [======================================================] 0s
Writing manifest to image destination
Storing signatures
INFO:    Creating SIF file...
INFO:    Build complete: /home/henrik.stranneheim/.singularity/cache/oci-tmp/224cbf2a1b76515629921bae06fac5788d7d705a971d20fc34f8338396d80655/hermes_add-dockerfile.sif
INFO:    Image cached as SIF at /home/henrik.stranneheim/.singularity/cache/oci-tmp/224cbf2a1b76515629921bae06fac5788d7d705a971d20fc34f8338396d80655/hermes_add-dockerfile.sif

 Usage: hermes [OPTIONS] COMMAND [ARGS]...

 Manage users in the awesome CLI app.

╭─ Options ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ --loglevel                  [DEBUG|INFO|WARNING]  Set the log level [default: INFO]                                                      │
│ --version                                                                                                                                │
│ --install-completion                              Install completion for the current shell.                                              │
│ --show-completion                                 Show completion for the current shell, to copy it or customize the installation.       │
│ --help                                            Show this message and exit.                                                            │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Commands ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ convert                                                                                                                                  │
│ export                                                                                                                                   │
│ validate                                                                                                                                 │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

@henrikstranneheim
Copy link
Contributor Author

Alias 👍

enrik.stranneheim@hasta:~] [base] $ which hermes
/usr/bin/which: no hermes in (/home/henrik.stranneheim/.local/bin:/home/proj/production/bin/miniconda3/bin:/home/henrik.stranneheim/.local/bin:/home/proj/production/bin/miniconda3/condabin:/usr/lib64/qt-3.3/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/opt/ganglia/bin:/opt/ganglia/sbin:/opt/pdsh/bin:/opt/rocks/bin:/opt/rocks/sbin:/opt/dell/srvadmin/bin)
[henrik.stranneheim@hasta:~] [base] $ ^Curce /home/proj/stage/servers/resources/hasta.scilifelab.se/usestage.sh
[henrik.stranneheim@hasta:~] [base] $ us
[henrik.stranneheim@hasta:~] [S_base] $ which hermes
alias hermes='/home/proj/stage/bin/miniconda3/envs/S_hermes/bin/hermes'
	/home/proj/stage/bin/miniconda3/envs/S_hermes/bin/hermes
[henrik.stranneheim@hasta:~] [S_base] $ source /home/proj/stage/servers/resources/hasta.scilifelab.se/usestage.sh
[henrik.stranneheim@hasta:~] [S_base] $ which hermes
alias hermes='singularity run --bind /home/proj/stage:/home/proj/stage /home/proj/stage/singularity_containers/hermes_latest.sif'
	/usr/bin/singularity
[henrik.stranneheim@hasta:~] [S_base] $ hermes --help
FATAL:   failed to retrieved path for /home/proj/stage/singularity_containers/hermes_latest.sif: lstat /home/proj/stage/singularity_containers/hermes_latest.sif: no such file or directory
[henrik.stranneheim@hasta:~] [S_base] $ ls  /home/proj/stage/singularity_containers/
cg_add-default-command.sif                     housekeeper_refactor-sql-filter-function-attr.sif
cg_lessen-archiving-limit.sif                  housekeeper_refactor-sql-handlers.sif
hermes_add-dockerfile.sif                      housekeeper_refactorto-PEP-0604_2.sif
housekeeper_197-improve-visualisation.sif      housekeeper_refactorto-PEP-0604.sif
housekeeper_add-cryptography.sif               housekeeper_separate-remote-files.sif
housekeeper_archiving-do-not-delete.sif        housekeeper_update-python.sif
housekeeper_archiving-fetch-limited-files.sif  housekeeper_use-poetry-instead-of-pip.sif
housekeeper_archiving-filter-on-tags.sif       trailblazer-cli_rm-conda-env-and-use-container.sif
housekeeper_archiving-get-retrieved-files.sif  trailblazer_dockerize-cli.sif
housekeeper_cascade-archive.sif                trailblazer_fix-cli-images.sif
housekeeper_fix-python-syntax-warning.sif      trailblazer_latest.sif
housekeeper_latest.sif                         trailblazer_upgrade-deploy-instructions.sif
housekeeper_master.sif
[henrik.stranneheim@hasta:~] [S_base] $ hermes-deploy
-bash: /home/proj/production/servers/resources/hasta.scilifelab.se/deployment/hermes-deploy.sh: No such file or directory
[henrik.stranneheim@hasta:~] [S_base] $ cp  /home/proj/stage/singularity_containers/hermes_add-dockerfile.sif /home/proj/stage/singularity_containers/hermes_latest.sif
[henrik.stranneheim@hasta:~] [S_base] $ hermes --help

 Usage: hermes [OPTIONS] COMMAND [ARGS]...

 Manage users in the awesome CLI app.

╭─ Options ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ --loglevel                  [DEBUG|INFO|WARNING]  Set the log level [default: INFO]                                                      │
│ --version                                                                                                                                │
│ --install-completion                              Install completion for the current shell.                                              │
│ --show-completion                                 Show completion for the current shell, to copy it or customize the installation.       │
│ --help                                            Show this message and exit.                                                            │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Commands ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ convert                                                                                                                                  │
│ export                                                                                                                                   │
│ validate                                                                                                                                 │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

@henrikstranneheim henrikstranneheim marked this pull request as ready for review November 6, 2024 10:23
@henrikstranneheim henrikstranneheim requested a review from a team as a code owner November 6, 2024 10:23
Copy link
Contributor

@jemten jemten left a comment

Choose a reason for hiding this comment

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

Great to get a dockerfile going for hermes and nice update to the PR template

Copy link
Contributor

@ChrOertlin ChrOertlin left a comment

Choose a reason for hiding this comment

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

Looks good!

Copy link
Contributor

@jemten jemten left a comment

Choose a reason for hiding this comment

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

👍

@henrikstranneheim
Copy link
Contributor Author

Dockerfile builds and runs

(cg-hermes-py3.12) henrikstranneheim in ~/git/hermes on branch add-dockerfile >  docker build -t hermes:latest .

[+] Building 10.6s (9/9) FINISHED                                                                                  docker:desktop-linux
 => [internal] load .dockerignore                                                                                                  0.0s
 => => transferring context: 2B                                                                                                    0.0s
 => [internal] load build definition from Dockerfile                                                                               0.0s
 => => transferring dockerfile: 328B                                                                                               0.0s
 => [internal] load metadata for docker.io/library/python:3.12-slim-bullseye                                                       0.7s
 => [1/4] FROM docker.io/library/python:3.12-slim-bullseye@sha256:6e2d8a88c5c53efe7d59b8b83b7d5bc2c066fc7d28d7db704c8479424cd4346  0.0s
 => [internal] load build context                                                                                                  0.4s
 => => transferring context: 943.03kB                                                                                              0.4s
 => CACHED [2/4] WORKDIR /app                                                                                                      0.0s
 => [3/4] COPY . /app/                                                                                                             0.6s
 => [4/4] RUN pip install --no-cache-dir --ignore-installed poetry     && poetry config virtualenvs.create false     && poetry in  8.5s
 => exporting to image                                                                                                             0.4s
 => => exporting layers                                                                                                            0.4s
 => => writing image sha256:0340a5bc757b96262ac1c5a3b6dc4e63421ea049f2220dad21c534b951a0166f                                       0.0s
 => => naming to docker.io/library/hermes:latest                                                                                   0.0s

What's Next?
  View summary of image vulnerabilities and recommendations → docker scout quickview
(cg-hermes-py3.12) henrikstranneheim in ~/git/hermes on branch add-dockerfile >  docker run hermes:latest export --help

                                                                                
 Usage: hermes export [OPTIONS] COMMAND [ARGS]...                               
                                                                                
╭─ Options ────────────────────────────────────────────────────────────────────╮
│ --help          Show this message and exit.                                  │
╰──────────────────────────────────────────────────────────────────────────────╯
╭─ Commands ───────────────────────────────────────────────────────────────────╮
│ tags   Export tag definitions from Hermes.                                   │
╰──────────────────────────────────────────────────────────────────────────────╯

(cg-hermes-py3.12) henrikstranneheim in ~/git/hermes on branch add-dockerfile > 

@henrikstranneheim
Copy link
Contributor Author

Redid tests using servers PR - passed as before.

@henrikstranneheim henrikstranneheim merged commit e0a6b15 into main Nov 21, 2024
3 checks passed
@henrikstranneheim henrikstranneheim deleted the add-dockerfile branch November 21, 2024 09:25
@henrikstranneheim
Copy link
Contributor Author

Deployed to prod

enrik.stranneheim@hasta:~] [base] $  hermes-deploy
Are you sure you want to pull the latest Hermes image? [Y/n] y
Pulling the latest Hermes image which will be used in stage and prod
WARNING: Authentication token file not found : Only pulls of public images will succeed
INFO:    Starting build...
Getting image source signatures
Skipping fetch of repeat blob sha256:55ab1b300d4b4b00c98fb396b36f0f7ba5dab2f7d18927e3742d364632723cbe
Skipping fetch of repeat blob sha256:0649af9ad5efea5dc7abeb426e4a4c7015ec86bba77b1d0e8ac3baca625ab82a
Skipping fetch of repeat blob sha256:07e281a95857e20e0dab09ba34ef88079e8666145a374c9757ea28d06d8ca9ac
Skipping fetch of repeat blob sha256:fb9990d14d0dbdfb200c5cddd2b531c36d758cdf6a4d43c26d9c1f3c5d9b19a7
Copying blob sha256:6e23a4f0c95c159ee39d3d50ea20fea96847662fd1e7a9d44ead0858f483fab4
 93 B / 93 B [==============================================================] 0s
Copying blob sha256:b74a1e6c703129172e72883217665444a81034ab2febea93e6ef7bf436ec267f
 201.63 KiB / 201.63 KiB [==================================================] 0s
Copying blob sha256:00a800db0f9c59b475dbaf6aa23181573e40fe559223b11916b15ae186c763cf
 30.76 MiB / 30.76 MiB [====================================================] 0s
Copying config sha256:7f931562bfcc4fc7f4a0c88b30c48c7cc23ef8cc2cd19c1ba89854a4f642baef
 6.03 KiB / 6.03 KiB [======================================================] 0s
Writing manifest to image destination
Storing signatures
INFO:    Creating SIF file...
INFO:    Build complete: /home/proj/stage/singularity_containers/hermes_temp.sif
Successfully pulled the latest Hermes image.
[henrik.stranneheim@hasta:~] [base] $ up
[henrik.stranneheim@hasta:~] [P_base] $ which hermes
alias hermes='singularity run --bind /home/proj/production:/home/proj/production /home/proj/stage/singularity_containers/hermes_latest.sif'
	/usr/bin/singularity
[henrik.stranneheim@hasta:~] [P_base] $ hermes --help

 Usage: hermes [OPTIONS] COMMAND [ARGS]...

 Manage users in the awesome CLI app.

╭─ Options ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ --loglevel                  [DEBUG|INFO|WARNING]  Set the log level [default: INFO]                                                      │
│ --version                                                                                                                                │
│ --install-completion                              Install completion for the current shell.                                              │
│ --show-completion                                 Show completion for the current shell, to copy it or customize the installation.       │
│ --help                                            Show this message and exit.                                                            │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Commands ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ convert                                                                                                                                  │
│ export                                                                                                                                   │
│ validate                                                                                                                                 │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

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.

4 participants