From 68329567e5c4ba21e278d6a90beba45f5f3adfc7 Mon Sep 17 00:00:00 2001 From: Kian-Tat Lim Date: Sat, 30 Mar 2024 19:21:09 -0700 Subject: [PATCH] Add build for presence service. --- .github/workflows/build.yaml | 14 +++++++++++++- Dockerfile.presence | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 Dockerfile.presence diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index aa127bf..32f164f 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -11,6 +11,7 @@ env: ENQUEUE_NAME: embargo-butler-enqueue INGEST_NAME: embargo-butler-ingest IDLE_NAME: embargo-butler-idle + PRESENCE_NAME: embargo-butler-presence jobs: push: @@ -20,7 +21,7 @@ jobs: contents: read steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Build enqueue image run: | @@ -43,6 +44,13 @@ jobs: --tag $IDLE_NAME \ --label "runnumber=${GITHUB_RUN_ID}" + - name: Build presence image + run: | + docker build . \ + -f Dockerfile.presence \ + --tag $PRESENCE_NAME \ + --label "runnumber=${GITHUB_RUN_ID}" + - name: Log in to GitHub Container Registry run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin @@ -51,6 +59,7 @@ jobs: ENQUEUE_ID=ghcr.io/${{ github.repository_owner }}/$ENQUEUE_NAME INGEST_ID=ghcr.io/${{ github.repository_owner }}/$INGEST_NAME IDLE_ID=ghcr.io/${{ github.repository_owner }}/$IDLE_NAME + PRESENCE_ID=ghcr.io/${{ github.repository_owner }}/$PRESENCE_NAME if [[ "${{ github.ref }}" == "refs/pull/"* ]]; then VERSION=$(echo "${{ github.head_ref }}" | sed -e 's|.*/||') @@ -62,6 +71,7 @@ jobs: echo ENQUEUE_ID=$ENQUEUE_ID echo INGEST_ID=$INGEST_ID echo IDLE_ID=$IDLE_ID + echo PRESENCE_ID=$PRESENCE_ID echo VERSION=$VERSION docker tag $ENQUEUE_NAME $ENQUEUE_ID:$VERSION docker push $ENQUEUE_ID:$VERSION @@ -69,3 +79,5 @@ jobs: docker push $INGEST_ID:$VERSION docker tag $IDLE_NAME $IDLE_ID:$VERSION docker push $IDLE_ID:$VERSION + docker tag $PRESENCE_NAME $PRESENCE_ID:$VERSION + docker push $PRESENCE_ID:$VERSION diff --git a/Dockerfile.presence b/Dockerfile.presence new file mode 100644 index 0000000..23ff0c7 --- /dev/null +++ b/Dockerfile.presence @@ -0,0 +1,32 @@ +# This file is part of embargo_butler. +# +# Developed for the LSST Data Management System. +# This product includes software developed by the LSST Project +# (http://www.lsst.org). +# See the COPYRIGHT file at the top-level directory of this distribution +# for details of code ownership. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Dockerfile for presence service. + +FROM python:3.11 +RUN pip install redis gunicorn flask +WORKDIR /presence +COPY src/presence.py src/utils.py /presence/ +# environment variables that must be set: +# REDIS_HOST REDIS_PASSWORD +# optional: +# DELETE_SEEN +ENTRYPOINT [ "gunicorn", "-b", "0.0.0.0:8000", "-w", "2", "presence:app" ]