Skip to content

Commit

Permalink
Merge branch 'release/1.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Noah Oblath committed Nov 17, 2022
2 parents 41fbb7c + 4509213 commit ff4069e
Show file tree
Hide file tree
Showing 10 changed files with 419 additions and 235 deletions.
113 changes: 113 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@

name: Build

on:
pull_request:
push:
branches: [main, develop]
tags: ['*']
workflow_dispatch:

env:
REGISTRY: ghcr.io

jobs:

build-and-publish:

name: Build and push the docker images

strategy:
matrix:
build: [Dev, Prod]
include:
- build: Dev
tag-suffix: '-dev'
- build: Prod
tag-suffix: ''

runs-on: ubuntu-latest
steps:

- name: Check out the repo
uses: actions/checkout@v3
with:
submodules: recursive
# Need to avoid a shallow clone (fetch-depth=1) so that the lookup of the tag works
fetch-depth: 0

- name: Docker meta
id: docker_meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ github.repository }}
flavor: |
latest=auto
suffix=${{ matrix.tag-suffix }},onlatest=true
tags: |
type=semver,pattern={{raw}}
type=ref,event=branch
type=ref,event=pr
- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
id: setup_buildx
uses: docker/setup-buildx-action@v1
with:
buildkitd-flags: --debug

- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Get previous tag
uses: "WyriHaximus/github-action-get-previous-tag@v1"
id: tag_name
with:
fallback: beta

- name: Build
id: build
uses: docker/build-push-action@v3
with:
context: .
file: ${{ matrix.build }}/Dockerfile
push: ${{ github.event_name == 'push' && contains(github.ref, 'refs/tags/') }}
build-args: |
img_repo=python
img_tag=bullseye
common_tag=${{ steps.tag_name.outputs.tag }}
tags: ${{ steps.docker_meta.outputs.tags }}
platforms: linux/amd64

- name: Release
uses: softprops/action-gh-release@v1
if: ${{ github.event_name == 'push' && contains(github.ref, 'refs/tags/') }}


# notify-packages:
#
# if: |
# (github.event_name == 'push' && contains(github.ref, 'refs/tags/') )
# || github.event_name == 'release'
# || github.event_name == 'workflow_dispatch'
# name: Trigger new docker images of the P8 software packages
# runs-on: ubuntu-latest
# needs: [build-and-publish]
# strategy:
# matrix:
# repo: ['project8/katydid']
## repo: ['project8/katydid', 'project8/locust_mc', 'project8/mermithid']
# steps:
#
# - name: Repository dispatch
# uses: peter-evans/repository-dispatch@v1
# with:
# token: ${{ secrets.REPO_ACCESS_TOKEN }}
# repository: ${{ matrix.repo }}
# event-type: release-event
100 changes: 0 additions & 100 deletions .github/workflows/publish.yaml

This file was deleted.

101 changes: 0 additions & 101 deletions Dependencies/Dockerfile

This file was deleted.

29 changes: 29 additions & 0 deletions Dev/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
ARG img_repo=python
ARG img_tag=bullseye

ARG common_tag=beta

FROM ${img_repo}:${img_tag} as base_image

# Set bash as the default shell
SHELL ["/bin/bash", "-c"]

ENV CMAKE_LIBRARY_PATH=/usr/lib64
ENV RapidJSON_DIR=/usr/lib64/cmake

# P8 and COMMON paths
ENV P8_ROOT=/usr/local/p8
ENV COMMON_TAG=${common_tag}
ENV COMMON_BUILD_PREFIX=${P8_ROOT}/common/$COMMON_TAG

# Copy all build scripts
ARG scripts_dir=${P8_ROOT}/common/build_scripts
COPY Scripts ${scripts_dir}

# Install as many dependencies as possible using apt
RUN ${scripts_dir}/install_packages.sh dev &&\
${scripts_dir}/install_python_packages.sh &&\
${scripts_dir}/install_other_packages.sh &&\
${scripts_dir}/create_common_setup.sh &&\
rm -rf ${scripts_dir} &&\
/bin/true
38 changes: 38 additions & 0 deletions Prod/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
ARG img_repo=python
ARG img_tag=bullseye

ARG common_tag=beta

FROM ${img_repo}:${img_tag} as base_image

# Set bash as the default shell
SHELL ["/bin/bash", "-c"]

ENV CMAKE_LIBRARY_PATH=/usr/lib64
ENV RapidJSON_DIR=/usr/lib64/cmake

# P8 and COMMON paths
ENV P8_ROOT=/usr/local/p8
ENV COMMON_TAG=${common_tag}
ENV COMMON_BUILD_PREFIX=${P8_ROOT}/common/$COMMON_TAG

# Copy all build scripts
ARG scripts_dir=${P8_ROOT}/common/build_scripts
COPY Scripts ${scripts_dir}

# Install as many dependencies as possible using apt
# Then do Python package installation
# Then install other packages not available in apt
# Create the setup.sh script
# Finally, remove unnecessary programs
# libhdf5-dev is removed because it was previously needed to install h5py, but isn't needed for running
RUN ${scripts_dir}/install_packages.sh prod &&\
${scripts_dir}/install_python_packages.sh &&\
${scripts_dir}/install_other_packages.sh &&\
apt-get purge -y \
wget \
libhdf5-dev \
&&\
${scripts_dir}/create_common_setup.sh &&\
rm -rf ${scripts_dir} &&\
/bin/true
Loading

0 comments on commit ff4069e

Please sign in to comment.