Skip to content

Commit

Permalink
.github/workflows: Added ubi8.yml and docker.yml
Browse files Browse the repository at this point in the history
  - Updated Dockerfile
  • Loading branch information
e10harvey committed Mar 18, 2024
1 parent c066a70 commit a1dbcc6
Show file tree
Hide file tree
Showing 4 changed files with 112 additions and 3 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: github-DOCKER

on:
push:
branches:
- main


permissions:
contents: none

env:
UBI8_IMAGE: "ghcr.io/sandialabs/opencsp:latest-ubi8"

jobs:
ubi8-image:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@v4

- name: Build image
run: echo UBI8_IMAGE=$UBI8_IMAGE && docker build . --file Dockerfile --tag $UBI8_IMAGE --label "runnumber=${GITHUB_RUN_ID}"

- name: Log in to registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin

- name: Push image
run: |
echo UBI8_IMAGE=$UBI8_IMAGE
docker push $UBI8_IMAGE
64 changes: 64 additions & 0 deletions .github/workflows/ubi8.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: github-UBI8

on:
pull_request:
paths-ignore:
- '**/*.rst'
- '**/*.md'
- 'doc/**'
types: [ opened, reopened, synchronize ]

permissions:
contents: none

# Cancels any in progress 'workflow' associated with this PR
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
UBI8_IMAGE: "ghcr.io/sandialabs/opencsp:latest-ubi8"

jobs:
ubi8-image:
runs-on: ubuntu-latest
permissions: write-all
steps:
- uses: actions/checkout@v4

- name: Build image
run: echo UBI8_IMAGE=$UBI8_IMAGE && docker build . --file Dockerfile --tag $UBI8_IMAGE --label "runnumber=${GITHUB_RUN_ID}"

- name: Log in to registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin

- name: Push image
run: |
echo UBI8_IMAGE=$UBI8_IMAGE
docker push $UBI8_IMAGE
ubi8-ci:
needs: ubi8-image
name: ubi8-ci
runs-on: [ubuntu-latest]
permissions:
packages: read
contents: read
container:
image: ghcr.io/sandialabs/opencsp:latest-ubi8
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

steps:
- name: checkout
uses: actions/checkout@v4
with:
path: OpenCSP

- name: pytest-cov
working-directory: OpenCSP/opencsp
run: |
python3 -m pip install -r ../requirements.txt
export PYTHONPATH=$PWD/../
pytest --color=yes -rs -vv --cov=. --cov-report term --cov-config=.coveragerc
12 changes: 9 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
ARG BASE_IMAGE_ARG=registry.access.redhat.com/ubi8:latest
FROM ${BASE_IMAGE_ARG}

ADD docker/centos8.repo /etc/yum.repos/d/centos8.repo

RUN rpm --import https://www.centos.org/keys/RPM-GPG-KEY-CentOS-Official && yum search xvfb

RUN yum -y install python3.11 \
python3.11-devel \
python3.11-pip \
mesa-libGL \
python3.11-tkinter \
python3-xvfbwrapper \
xz
xz \
gcc

# Installing ffmpeg via relies on the rpmfusion repo and SDL2
# The SDL2 yum package is not currently available in ubi8
Expand All @@ -21,4 +26,5 @@ RUN tar -xf ffmpeg-*-amd64-static.tar.xz && \
ENV PYTHONPATH=/code

COPY requirements.txt /code/
RUN python3 -m pip install -r requirements.txt
RUN python3 -m pip install -r requirements.txt
ENV PATH=$HOME/.local/bin:$PATH
6 changes: 6 additions & 0 deletions docker/centos8.repo
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[CentOS-8]
name=CentOS-8
baseurl=http://mirror.centos.org/centos/8-stream/AppStream/x86_64/os/
enabled=1
gpgcheck=1
gpgkey=https://www.centos.org/keys/RPM-GPG-KEY-CentOS-Official

0 comments on commit a1dbcc6

Please sign in to comment.