Skip to content

Commit

Permalink
Adding ilab-base
Browse files Browse the repository at this point in the history
  • Loading branch information
jordancaraballo committed Jan 16, 2024
1 parent 03ff8f0 commit 7f51c30
Show file tree
Hide file tree
Showing 98 changed files with 131 additions and 59 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/ilab-base-singularity.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Singularity Build (docker)
on:
push:

# Edit the branches here if you want to change deploy behavior
branches:
- github-registry-changes

# Do the builds on all pull requests (to test them)
pull_request: []

jobs:
changes:
name: "Changed Singularity Recipes"
runs-on: ubuntu-latest
outputs:
changed_file: ${{ steps.files.outputs.added_modified }}
steps:
- id: files
uses: jitterbit/get-changed-files@b17fbb00bdc0c0f63fcf166580804b4d2cdc2a42
with:
format: 'json'

build-containers:
needs:
- changes
runs-on: ubuntu-latest

container:
image: quay.io/singularity/singularity:v3.11.5
options: --privileged

name: Check ilab-base
steps:

- name: Check out code for the container builds
uses: actions/checkout@v2

- name: Build Container
run: |
ls
sudo -E singularity build container.sif singularity/ilab-base/ilab-base.def
echo "Tag is $tag."
echo "tag=$tag" >> $GITHUB_ENV
- name: Login and Deploy Container
if: (github.event_name != 'pull_request')
env:
keepgoing: ${{ env.keepgoing }}
run: |
echo ${{ secrets.GITHUB_TOKEN }} | singularity remote login -u ${{ secrets.GHCR_USERNAME }} --password-stdin oras://ghcr.io
singularity push container.sif oras://ghcr.io/${GITHUB_REPOSITORY}:${tag}
111 changes: 70 additions & 41 deletions .github/workflows/ilab-base.yaml
Original file line number Diff line number Diff line change
@@ -1,52 +1,81 @@
name: Singularity Build (docker)
on:
push:
name: ilab-base-docker

# Edit the branches here if you want to change deploy behavior
on:
push:
branches:
- github-registry-changes

# Do the builds on all pull requests (to test them)
pull_request: []
- 'main'

jobs:
changes:
name: "Changed Singularity Recipes"

ilab-base-production:
runs-on: ubuntu-latest
outputs:
changed_file: ${{ steps.files.outputs.added_modified }}
steps:
- id: files
uses: jitterbit/get-changed-files@b17fbb00bdc0c0f63fcf166580804b4d2cdc2a42
-
name: Checkout
uses: actions/checkout@v3
-
name: Set up QEMU
uses: docker/setup-qemu-action@v2
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Login to Docker Hub
uses: docker/login-action@v2
with:
format: 'json'

build-containers:
needs:
- changes
runs-on: ubuntu-latest

container:
image: quay.io/singularity/singularity:v3.11.5
options: --privileged
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

name: Check ilab-base
steps:
-
name: Lower github-runner storage
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- name: Check out code for the container builds
uses: actions/checkout@v2
-
name: Build and push
uses: docker/build-push-action@v4
with:
context: .
file: ./docker/ilab-base/Dockerfile.ilab-base-gdal-3.3.3
push: true
tags: nasanccs/ilab-base:latest

- name: Build Container
ilab-base-dev:
runs-on: ubuntu-latest
on: [push, pull_request]
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Set up QEMU
uses: docker/setup-qemu-action@v2
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

-
name: Lower github-runner storage
run: |
ls
sudo -E singularity build container.sif singularity/ilab-base/ilab-base.def
echo "Tag is $tag."
echo "tag=$tag" >> $GITHUB_ENV
- name: Login and Deploy Container
if: (github.event_name != 'pull_request')
env:
keepgoing: ${{ env.keepgoing }}
run: |
echo ${{ secrets.GITHUB_TOKEN }} | singularity remote login -u ${{ secrets.GHCR_USERNAME }} --password-stdin oras://ghcr.io
singularity push container.sif oras://ghcr.io/${GITHUB_REPOSITORY}:${tag}
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
-
name: Build and push
uses: docker/build-push-action@v4
with:
context: .
file: ./requirements/Dockerfile
push: true
tags: nasanccs/ilab-base:dev
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ FROM osgeo/gdal:ubuntu-full-3.3.3

RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
#COPY Dockerfile.ilab-base-gdal-3.3.3-v2 /usr/src/app/

ENV PROJECT_PATH="/usr/local/ilab"
ENV REDIS_FILE="/etc/profile.d/redis_server.sh"
Expand All @@ -13,9 +12,9 @@ RUN mkdir -p $PROJECT_PATH
#-------------------------------------------------------------------------------
RUN mkdir -p /att/nobackup /lscratch /att/gpfsfs/atrepo01 /att/pubrepo /css/nga/INDEX/current/nga_footprint.gdb
# TODO: Deal with /gpfs weirdness below. Doesn't this break container portability?
#RUN for i in $(seq 1 30); do
#RUN ln -s /gpfs/gsfs${i} /gs${i};
#RUN done
# RUN for i in $(seq 1 30); do
# RUN ln -s /gpfs/gsfs${i} /gs${i};
# RUN done

#-------------------------------------------------------------------------------
# System Dependencies
Expand Down Expand Up @@ -92,14 +91,14 @@ RUN python -m pip install pygeotools

RUN python -m pip cache purge

# Add redis-server binary to /usr/local/bin
# Add redis-server binary to /usr/local/bin
# export pyVer=`python --version | awk -F' ' '{print $2}' | awk -F'.' '{print $1"."$2}'`
RUN ln -sf /usr/local/lib/python3.8/dist-packages/redis_server/bin/redis-server /usr/local/bin/redis-server

# 3/11/22 modified by Caleb for verson 2.0.0 for testing of 2 lines below
# 5/4/22 Testing passed. nepac and.. app containers also passed so making this ilab-base-3.3.3-v2 the new production version 2.
# Setup redis-server daemon. Sets REDIS_PORT env variable for celery-based applications to reference the correct redis port at run-time.
# echo "export REDIS_PORT=\"\$(python -c 'import socket; s = socket.socket(); s.bind((\"\", 0)); print(s.getsockname()[1]); s.close();')\"" > $REDIS_FILE
# 3/11/22 modified by Caleb for verson 2.0.0 for testing of 2 lines below
# 5/4/22 Testing passed. nepac and.. app containers also passed so making this ilab-base-3.3.3-v2 the new production version 2.
# Setup redis-server daemon. Sets REDIS_PORT env variable for celery-based applications to reference the correct redis port at run-time.
# echo "export REDIS_PORT=\"\$(python -c 'import socket; s = socket.socket(); s.bind((\"\", 0)); print(s.getsockname()[1]); s.close();')\"" > $REDIS_FILE
RUN echo "redis-server --daemonize yes --port \$REDIS_PORT" >> $REDIS_FILE;
RUN echo "export SINGULARITYENV_REDIS_PORTS=\$REDIS_PORT" >> $REDIS_FILE;
RUN chmod +x $REDIS_FILE;
Expand All @@ -114,12 +113,4 @@ RUN chmod +x $REDIS_FILE;
### #/bin/bash -c "export REDIS_PORT=6379"
### exec /bin/bash -c "source /etc/profile.d/redis_server.sh"
###
### %test

RUN cat /etc/os-release | grep 20
RUN gdalinfo --formats | grep -i jpeg
RUN gdalinfo --formats | grep -i hdf
RUN ogrinfo --formats | grep GDB
RUN python -V | grep 3
RUN python -c 'from osgeo import gdal; print(gdal.__version__)'

### %test
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 7f51c30

Please sign in to comment.