diff --git a/.github/workflows/build_docker_dependencies_image.yml b/.github/workflows/build_docker_dependencies_image.yml index 011c00bf..5b49b66e 100644 --- a/.github/workflows/build_docker_dependencies_image.yml +++ b/.github/workflows/build_docker_dependencies_image.yml @@ -8,7 +8,11 @@ on: - 'v*' paths: - dockerfiles/microservices-dependencies.dockerfile - + pull_request: + types: [closed] + branches: + - develop + workflow_dispatch: jobs: diff --git a/.github/workflows/build_docker_image.yml b/.github/workflows/build_docker_image.yml index bde9a023..6a042ad2 100644 --- a/.github/workflows/build_docker_image.yml +++ b/.github/workflows/build_docker_image.yml @@ -8,6 +8,10 @@ on: - 'v*' paths: - Dockerfile + pull_request: + types: [closed] + branches: + - develop workflow_dispatch: diff --git a/docs/README.md b/docs/README.md index 40b8b0fe..83859a07 100644 --- a/docs/README.md +++ b/docs/README.md @@ -2,19 +2,36 @@ To run one of the provided microservices in this repo, the basic command is the following: ``` -docker run --rm -e MICROSERVICE= ghcr.io/dune-daq/microservices:9685 +docker run --rm -e MICROSERVICE= ghcr.io/dune-daq/microservices:develop ``` There are a couple of points to note: * The value of MICROSERVICE should be the name of a given microservice's subdirectory in this repo. As of Oct-6-2023, the available subdirectories are: `config-service`, `ers-dbwriter`, `ers-protobuf-dbwriter`, `logbook`, `opmon-dbwriter`, `runnumber-rest` and `runregistry-rest`. * Most microservices require additional environment variables to be set, which can be passed using the usual docker syntax: `-e VARIABLE_NAME=` * If you don't know what these additional environment variables are, you can just run the `docker` command as above without setting them; the container will exit out almost immediately but only after telling you what variables are missing -* The `9685` tag for the image in the example above just refers to the first four characters of the git commit of the microservices repo whose `dockerfiles/Dockerfile.microservices` Docker file was used to create the image. Currently [Dec-08-2023] this is the head of a branch soon to be merged in develop with a PR. +* The microservices image tag will be `microservices:` or `microservices:`, i.e. `microservices:develop`. +* The microservices dependency image tag is `microservices_dependencies:` or `microservices_dependencies:` For details on a given microservice, look at its own README file (format is `docs/README_.md`). They may or may not be up to date, however. -## building images -When building from a branch that is not develop you need to specify the branch you want to use to build the code, e.g.: +## Building images +There are two workflow actions on GitHub to build the `microservices` and `microservices_dependencies` images. This can be run on GitHub directly and will create the images, tag them and push them for use. + +The `microservices_dependencies` image is used as the base image for `microservies` and so any changes to the `requirements.txt` file requires rebuilding the `microservices_dependencies` image. + +If you do not wish to to push your changes to the repo when testing, you can also use: + ```bash -docker build -f Dockerfile.microservices -t ghcr.io/dune-daq/microservices:user-my-branch --build-arg BRANCH=my-branch . +docker build -f Dockerfile -t ghcr.io/dune-daq/microservices:user-my-branch . + +docker push ghcr.io/dune-daq/microservices:user-my-branch ``` +and + +```bash +docker build -f dockerfiles/microservices-dependencies.dockerfile -t ghcr.io/dune-daq/microservices_dependencies:user-my-branch /dockerfiles + +docker push ghcr.io/dune-daq/microservices_dependencies:user-my-branch +``` + +This will copy your current microservices directory. \ No newline at end of file