Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DEV-932] Deploy litmapper on TH874 #1

Open
wants to merge 19 commits into
base: main
Choose a base branch
from
Open
265 changes: 265 additions & 0 deletions .github/workflows/docker-build-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,265 @@
name: Docker

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

on:
push:
branches: [ "main", DEV-932 ]
# Publish semver tags as releases.
tags: [ 'v*.*.*' ]

env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>

LITMAPPER_BACKEND_IMAGE_NAME: USEPA/litmapper-backend
LITMAPPER_ETL_IMAGE_NAME: USEPA/litmapper-etl
LITMAPPER_FRONTEND_IMAGE_NAME: USEPA/litmapper-frontend
LITMAPPER_SPECTER_IMAGE_NAME: USEPA/litmapper-specter


jobs:
backend-build-push:

runs-on: ubuntu-latest
environment: ${{ github.head_ref || github.ref_name }}
permissions:
contents: write
packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

# Workaround: https://github.com/docker/build-push-action/issues/461
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v3

# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: USEPA
password: ${{ secrets.GITHUB_TOKEN }}

# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.LITMAPPER_BACKEND_IMAGE_NAME }}

# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v4
with:
context: ./backend/
file: ./backend/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}


# Removing old packages and only keeping 3 untagged versions
- name: Delete Package Versions
uses: actions/delete-package-versions@v5
with:
package-name: litmapper-backend
package-type: 'container'
min-versions-to-keep: 3
delete-only-untagged-versions: 'true'

etl-build-push:

runs-on: th874
environment: ${{ github.head_ref || github.ref_name }}
permissions:
contents: write
packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

# Workaround: https://github.com/docker/build-push-action/issues/461
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v3

# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: USEPA
password: ${{ secrets.GITHUB_TOKEN }}

# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env. LITMAPPER_ETL_IMAGE_NAME }}

# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v4
with:
context: ./etl/
file: ./etl/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}


# Removing old packages and only keeping 3 untagged versions
- name: Delete Package Versions
uses: actions/delete-package-versions@v5
with:
package-name: litmapper-etl
package-type: 'container'
min-versions-to-keep: 3
delete-only-untagged-versions: 'true'

frontend-build-push:
runs-on: ubuntu-latest
environment: ${{ github.head_ref || github.ref_name }}
permissions:
contents: write
packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

# Create .env file for build
- name: Creating .env file
run: echo "$ENV_TEXT" > ./frontend/.env
env:
ENV_TEXT: ${{vars.ENV_TEXT}}

# Workaround: https://github.com/docker/build-push-action/issues/461
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v3

# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: USEPA
password: ${{ secrets.GITHUB_TOKEN }}

# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.LITMAPPER_FRONTEND_IMAGE_NAME }}

# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v5
with:
context: ./frontend/
file: ./frontend/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}


# Removing old packages and only keeping 3 untagged versions
- name: Delete Package Versions
uses: actions/delete-package-versions@v5
with:
package-name: litmapper-frontend
package-type: 'container'
min-versions-to-keep: 3
delete-only-untagged-versions: 'true'

specter-build-push:
runs-on: ubuntu-latest
environment: ${{ github.head_ref || github.ref_name }}
permissions:
contents: write
packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

# Workaround: https://github.com/docker/build-push-action/issues/461
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v3

# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: USEPA
password: ${{ secrets.GITHUB_TOKEN }}

# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.LITMAPPER_SPECTER_IMAGE_NAME }}

# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v5
with:
context: ./specter/
file: ./specter/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}


# Removing old packages and only keeping 3 untagged versions
- name: Delete Package Versions
uses: actions/delete-package-versions@v5
with:
package-name: litmapper-specter
package-type: 'container'
min-versions-to-keep: 3
delete-only-untagged-versions: 'true'

2 changes: 1 addition & 1 deletion etl/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/machi
RUN apt-get update && apt-get install -y \
git libhdf5-dev \
&& rm -rf /var/lib/apt/lists/*

COPY ./requirements.txt /code/requirements.txt
RUN pip install --no-cache numpy==1.26.4 \
&& pip install --no-cache Cython==0.29.37 \
Expand Down
1 change: 1 addition & 0 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
FROM node:20.13.1-slim

WORKDIR /code
COPY . /code
COPY ./package.json ./package-lock.json ./

RUN npm install
Expand Down
2 changes: 2 additions & 0 deletions specter/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ WORKDIR /code

COPY ./requirements.txt /code/requirements.txt
RUN pip install -r /code/requirements.txt