Skip to content

Commit

Permalink
Add build for presence service.
Browse files Browse the repository at this point in the history
  • Loading branch information
ktlim committed Mar 31, 2024
1 parent 2453c3c commit 7c429a6
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
14 changes: 13 additions & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -20,7 +21,7 @@ jobs:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Build enqueue image
run: |
Expand All @@ -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

Expand All @@ -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|.*/||')
Expand All @@ -62,10 +71,13 @@ 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
docker tag $INGEST_NAME $INGEST_ID:$VERSION
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
32 changes: 32 additions & 0 deletions Dockerfile.presence
Original file line number Diff line number Diff line change
@@ -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 <http://www.gnu.org/licenses/>.

# 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" ]

0 comments on commit 7c429a6

Please sign in to comment.