From b4bfc2f6d5afb0690bb600892cc43961ef306d2b Mon Sep 17 00:00:00 2001 From: VenissaCarolQuadros Date: Mon, 21 Apr 2025 11:55:58 -0400 Subject: [PATCH 1/4] Add workflow to build for TAT service --- .github/workflows/tat.yml | 78 +++++++++++++++++++++++++++++++++++++++ Dockerfile | 11 ++++++ 2 files changed, 89 insertions(+) create mode 100644 .github/workflows/tat.yml create mode 100644 Dockerfile diff --git a/.github/workflows/tat.yml b/.github/workflows/tat.yml new file mode 100644 index 000000000..f24bade06 --- /dev/null +++ b/.github/workflows/tat.yml @@ -0,0 +1,78 @@ +name: Tactile Authoring Tool Service +on: + push: + branches: [ main ] + tags: [ "service-tat-[0-9]+.[0-9]+.[0-9]+" ] + paths: [ "**" ] + pull_request: + branches: [ main ] + paths: [ "**" ] + workflow_dispatch: +env: + REGISTRY: ghcr.io + IMAGE_NAME: shared-reality-lab/image-service-tat +jobs: + lint: + name: PEP 8 style check. + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: '3.x' + - name: Install flake8 + run: pip install flake8 + - name: Check with flake8 + run: python -m flake8 ./services/tat --show-source + build-and-push-image: + name: Build and Push to Registry + needs: lint + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - name: Checkout repository + uses: actions/checkout@v3 + with: + submodules: true + - name: Log into GHCR + uses: docker/login-action@v2 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Get Correct Tags + run: | + if [[ ${{ github.ref }} =~ ^refs/tags/service-tat-[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + echo "TAGGED=true" >> $GITHUB_ENV + else + echo "TAGGED=false" >> $GITHUB_ENV + fi + - name: Get timestamp + run: echo "timestamp=$(date -u +'%Y-%m-%dT%H.%M')" >> $GITHUB_ENV + - name: Extract metadata + id: meta + uses: docker/metadata-action@v4 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + flavor: | + latest=${{ env.TAGGED }} + tags: | + type=match,enable=${{ env.TAGGED }},priority=300,pattern=service-tat-(\d+.\d+.\d+),group=1 + type=raw,priority=200,value=unstable + type=raw,priority=100,value=${{ env.timestamp }} + labels: | + org.opencontainers.image.title=IMAGE Service Monarch Link App + org.opencontainers.image.description=Service to link Monarch client with tactile authoring tool. + org.opencontainers.image.authors=IMAGE Project + org.opencontainers.image.licenses=AGPL-3.0-or-later + maintainer=IMAGE Project + - name: Build and push + uses: docker/build-push-action@v3 + with: + context: . + file: ./Dockerfile + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..5adef2a28 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +# Stage 1: Build the application +FROM node:20-alpine AS build + +# Set the working directory inside the container +WORKDIR /app + +# Copy application into container +COPY . /app + +# Install dependencies +RUN npm install \ No newline at end of file From 5d75e1de6a0b56f0fbce19967ef7ab67d4dbe9e4 Mon Sep 17 00:00:00 2001 From: VenissaCarolQuadros Date: Mon, 21 Apr 2025 12:51:34 -0400 Subject: [PATCH 2/4] remove lint checks for files that don't exist --- .github/workflows/tat.yml | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/.github/workflows/tat.yml b/.github/workflows/tat.yml index f24bade06..42f79f69a 100644 --- a/.github/workflows/tat.yml +++ b/.github/workflows/tat.yml @@ -12,18 +12,6 @@ env: REGISTRY: ghcr.io IMAGE_NAME: shared-reality-lab/image-service-tat jobs: - lint: - name: PEP 8 style check. - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 - with: - python-version: '3.x' - - name: Install flake8 - run: pip install flake8 - - name: Check with flake8 - run: python -m flake8 ./services/tat --show-source build-and-push-image: name: Build and Push to Registry needs: lint From 7f4973be7a8c7dee5f4d52ab292f98e7751537c6 Mon Sep 17 00:00:00 2001 From: VenissaCarolQuadros Date: Mon, 21 Apr 2025 12:54:30 -0400 Subject: [PATCH 3/4] Remove lint dependency from build job in workflow --- .github/workflows/tat.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/tat.yml b/.github/workflows/tat.yml index 42f79f69a..bca4264a8 100644 --- a/.github/workflows/tat.yml +++ b/.github/workflows/tat.yml @@ -14,7 +14,6 @@ env: jobs: build-and-push-image: name: Build and Push to Registry - needs: lint runs-on: ubuntu-latest permissions: contents: read From 4873b711c7ff0bd7517749f0830379f12968c6d9 Mon Sep 17 00:00:00 2001 From: VenissaCarolQuadros Date: Mon, 21 Apr 2025 13:43:15 -0400 Subject: [PATCH 4/4] Change image name --- .github/workflows/tat.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tat.yml b/.github/workflows/tat.yml index bca4264a8..7bc589554 100644 --- a/.github/workflows/tat.yml +++ b/.github/workflows/tat.yml @@ -10,7 +10,7 @@ on: workflow_dispatch: env: REGISTRY: ghcr.io - IMAGE_NAME: shared-reality-lab/image-service-tat + IMAGE_NAME: shared-reality-lab/tat-service jobs: build-and-push-image: name: Build and Push to Registry