Draft: Build docker
Added a Dockerfile to build Docker containers, with base image python:3.x
. The Dockerfile is in the project root directory.
Added a CI stage build-docker
with one job that builds an image based on python:3.9
. The job runs on the CNAF gitlab runner (tag: cnaf
).
The job is triggered when a new tag is created. Optionally, it can be triggered by MR to the main
branch. The YAML file of the job is stored in the docker
dir.
Created two scripts for building images locally (not required for the CI job). README is included.
Merge request reports
Activity
assigned to @roberto.depietri
@ron.tapia This work is an update of Ron Tapia's work on the need for a k8s deployment of gwcelery. It replaces the merge request !822 (closed) It is deeply based on the work done on that merge request.
changed milestone to %O4-low-priority
added 51 commits
-
f22ef19b...8d2d8cd6 - 7 commits from branch
emfollow:main
- b52fc47f - Add Dockerfile
- cac9d3ec - Add directory for docker build
- a2b6654e - Update Dockerfile, removing unnecessary code
- 191ce004 - Add readme with build instructions
- 54488304 - minor correction
- 34251bb2 - Add script for local build
- 932c4b7a - add script for building from repo
- 977ccd08 - add job for docker build
- 9185c716 - add build docker stage and import yaml
- e3e16653 - added default env variables
- c0c02e4e - Update docker-build.yml
- bb77bfa6 - added default args for scripts
- 765df953 - Update README.md
- 7838a0bf - changed runner tag
- 917e53d3 - Update docker-build.yml
- 9e3ef285 - Update Dockerfile
- 971b324f - Update .gitlab-ci.yml
- 8ab9e1c1 - changed image tag variable, moved script to general config
- 0942f44a - Update README.md
- ab5c2e9f - Update README.md
- 86a2ed95 - changed variable to string
- d6c6b150 - Update Dockerfile
- 576fd5af - Update README.md
- 336ccdb9 - Update docker-build.yml
- 97deadea - added job prerequisites
- 843e1904 - Update docker-build.yml
- 8daaed60 - Update docker-build.yml
- 366786d8 - Update docker-build.yml
- cc4ce1bc - Update docker-build.yml
- a3ccbcc7 - Update docker-build.yml
- f4d2efd2 - Update docker-build.yml
- 6b96c57a - Update docker-build.yml
- d00ed3a5 - Update docker-build.yml
- 51347d3a - Update docker-build.yml
- 8b03f4ff - Update docker-build.yml
- 9510d55c - Update docker-build.yml
- 10c56459 - Update docker-build.yml
- 52c02d58 - Update docker-build.yml
- b578ef82 - Update docker-build.yml
- ba739dfc - Update docker-build.yml
- a94257ea - Update docker-build.yml
- 6cd0adfb - Update docker-build.yml
- 3dbec798 - Update docker-build.yml
- ec26b8f1 - Merge branch 'build-docker' of git.ligo.org:sara.vallero/gwcelery into build-docker
Toggle commit list-
f22ef19b...8d2d8cd6 - 7 commits from branch
added 2 commits
added 1 commit
- d1319f75 - Added Dockerfile, added docker dir with build scripts, added ci job
- docker/docker-build.yml 0 → 100644
28 when: never 29 variables: 30 IMAGE_TAG: $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME 31 script: 32 #- docker build --build-arg from=repo --build-arg url="${CI_REPOSITORY_URL}" --build-arg tag_or_branch="${GWCELERY_TAG}" --build-arg python=${PYTHON_VERSION} -t "${CI_REGISTRY_IMAGE}/python${PYTHON_VERSION}:${IMAGE_TAG}" . 33 - docker build --build-arg from=local --build-arg python=${PYTHON_VERSION} -t "${CI_REGISTRY_IMAGE}/python${PYTHON_VERSION}:${IMAGE_TAG}" . 34 - docker push "${CI_REGISTRY_IMAGE}/python${PYTHON_VERSION}:${IMAGE_TAG}" 35 36 # Main build job. 37 # See docker/README.md for build instructions. 38 docker/build/python3.9: 39 variables: 40 PYTHON_VERSION: "3.9" 41 needs: 42 - test/poetry/python3.9 43 - test/wheel/python3.9 @deep.chatterjee I do agree with you. Now the build is performed after the test is successful, meaning the code should we work. In this case, the docker image is built. This is the first step. Once we have that merge, we will study a way to add a final step in the build docker to test the sanity of the produced docker image. That would be easy to add once this merge request is in. I will put that on the to-do-list.
The image being built does not imply the code will work. In fact right now, the code will NOT work since there is no redis server in the container. The first step to know the container is built correctly is to ensure that at least the unittests are running correctly against it. Please add that in.
@roberto.depietri it is unclear to me what is being done where. I hope you agree that with me that this dockerfile, the code will not work, because celery itself will not start. If you have a dedicated config repo for the CNAF deployment of gwcelery and other services, it should live there.
A lot of details are opaque (like I mentioned in !1072 (merged) as well). Can I suggest your and others create a different milestone, or any other gitlab feature as you see fit, and move all the containerization and kubernetes related MRs there. Since this is not a priority item, I would like to visit this all together once we have taken care of the other priority items.
Also, installing from poetry will install the redis client as a part of celery, but the redis server is also needed. This is done as a part of the unittesting stage and can be re-used.
- docker/docker-build.yml 0 → 100644
18 tags: 19 - cnaf 20 rules: 21 - if: $CI_COMMIT_TAG 22 when: always 23 variables: 24 IMAGE_TAG: $CI_COMMIT_TAG 25 # The following condition triggers the pipeline for MRs to the main branch 26 # Set "when: manual" to enable it for your branch 27 - if: $CI_PIPELINE_SOURCE == 'merge_request_event' && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == 'main' 28 when: never 29 variables: 30 IMAGE_TAG: $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME 31 script: 32 #- docker build --build-arg from=repo --build-arg url="${CI_REPOSITORY_URL}" --build-arg tag_or_branch="${GWCELERY_TAG}" --build-arg python=${PYTHON_VERSION} -t "${CI_REGISTRY_IMAGE}/python${PYTHON_VERSION}:${IMAGE_TAG}" . 33 - docker build --build-arg from=local --build-arg python=${PYTHON_VERSION} -t "${CI_REGISTRY_IMAGE}/python${PYTHON_VERSION}:${IMAGE_TAG}" . mentioned in merge request !1072 (merged)
@deep.chatterjee The redis server is NOT needed to run gwcelery. In fact, the openmp workers are running at caltech on machines that do not have redis installed and they use the redis server running on the emfollow machine.
That is only because you have redis server running and celery can connect to. So "The redis server is NOT needed to run gwcelery" is simply wrong. Any celery application needs a result backend to run. We use redis.
So without the server running in the container, or being a separate service or part of a compose file which should also live here, this by itself does not make much sense.
Edited by Deep Chatterjee@deep.chatterjee this build stage is the first necessary step for a complete pipeline that will deploy gwcelery, redis, gracedb and hop for acceptance/integration tests on k8s. It is not meant to replace the unittests already implemented, but just to produce a base environment with correct dependencies.
@deep.chatterjee @cody.messick This is the merge request we need to start working on automatic testing and CI integration. It creates a docker file (suited for the purpose) and has no side effects on gwceley functionality.