-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from hydroshare/artifacts
Add actions to build microservices
- Loading branch information
Showing
4 changed files
with
199 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
name: Test build | ||
|
||
on: push | ||
|
||
jobs: | ||
detect-changes: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
# Expose matched filters as job 'variants' output variable | ||
image_variants: ${{ steps.filter.outputs.changes }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: dorny/paths-filter@v2 | ||
# https://github.com/marketplace/actions/paths-changes-filter#conditional-execution | ||
id: filter | ||
with: | ||
# detect changes against last commit | ||
base: ${{ github.ref }} | ||
filters: | | ||
Dockerfile: Dockerfile | ||
Dockerfile-deb: Dockerfile-deb | ||
build: | ||
needs: detect-changes | ||
name: Setup, Build | ||
runs-on: ubuntu-latest | ||
continue-on-error: true | ||
if : ${{ needs.detect-changes.outputs.image_variants != '[]' }} | ||
strategy: | ||
max-parallel: 6 | ||
# select a core set of images to build | ||
matrix: | ||
IMAGE_VARIANT: ${{ fromJSON(needs.detect-changes.outputs.image_variants) }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Build | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
file: ${{ matrix.IMAGE_VARIANT }} | ||
tags: quota-microservices | ||
push: false | ||
load: true | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
|
||
- name: Extract built package | ||
uses: shrink/actions-docker-extract@v3 | ||
id: extract | ||
with: | ||
image: quota-microservices | ||
path: /output/. | ||
destination: output | ||
|
||
# Archive the built package | ||
- name: Archive artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: compiled-artifacts | ||
path: output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
name: Periodically Build | ||
|
||
on: | ||
schedule: | ||
- cron: '0 0 * * 0' # At 00:00 every Sunday | ||
|
||
workflow_dispatch: | ||
|
||
jobs: | ||
setup-build: | ||
name: Setup, Build | ||
runs-on: ubuntu-latest | ||
continue-on-error: true | ||
strategy: | ||
max-parallel: 6 | ||
# select a core set of images to build | ||
matrix: | ||
IMAGE_VARIANT: | ||
- Dockerfile | ||
# - Dockerfile-deb # don't build deb package for now | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
if: ${{ github.event.action }} != 'workflow_dispatch' | ||
|
||
- name: Checkout, ref = ${{ github.ref_name }} | ||
uses: actions/checkout@v2 | ||
if: ${{ github.event.action }} == 'workflow_dispatch' | ||
with: | ||
ref: ${{ github.ref_name }} | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Build | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
file: ${{ matrix.IMAGE_VARIANT }} | ||
tags: quota-microservices | ||
push: false | ||
load: true | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
|
||
- name: Extract built package | ||
uses: shrink/actions-docker-extract@v3 | ||
id: extract | ||
with: | ||
image: quota-microservices | ||
path: /output/. | ||
destination: output | ||
|
||
# Archive the built package | ||
- name: Archive artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: compiled-artifacts | ||
path: output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
FROM centos:centos7.6.1810 as builder | ||
RUN yum makecache -y && \ | ||
yum clean all&& \ | ||
yum update -y | ||
RUN yum install -y epel-release \ | ||
yum-utils \ | ||
vim-enhanced \ | ||
expect \ | ||
wget \ | ||
git | ||
RUN yum install -y pwgen \ | ||
jq | ||
RUN rpm --import https://packages.irods.org/irods-signing-key.asc && \ | ||
wget -qO - https://packages.irods.org/renci-irods.yum.repo | tee /etc/yum.repos.d/renci-irods.yum.repo | ||
RUN yum makecache -y && \ | ||
yum group install -y "Development Tools" --setopt=group_package_types=mandatory,default,optional | ||
RUN yum install -y --skip-broken irods-externals-* | ||
RUN yum install -y openssl-devel libcurl-devel | ||
RUN yum install -y irods-devel-4.2.11-1 | ||
COPY . /hydroshare-quota | ||
# CMakeLists.txt must match iRODS version specified. This file is under version control | ||
# cmake3.21 for iRODS 4.3.x | ||
# cmake3.11.4-0 for iRODS 4.2.x | ||
WORKDIR /hydroshare-quota/ | ||
RUN /opt/irods-externals/cmake3.11.4-0/bin/cmake . 2>&1 | tee cmake.stdout | ||
RUN cat cmake.stdout | ||
RUN make package 2>&1 | tee make.stdout | ||
# Investigate for Rocky/RHEL 9 | ||
RUN mkdir /output && mv *.rpm /output/ | ||
|
||
FROM alpine | ||
COPY --from=builder /output /output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
FROM debian:bullseye as builder | ||
RUN apt-get update | ||
RUN apt-get install -y libcurl4-openssl-dev libssl-dev build-essential vim | ||
RUN apt-get install -y sudo git python3 python3-distro | ||
RUN apt-get install gnupg2 wget | ||
RUN wget -qO - https://packages.irods.org/irods-signing-key.asc | sudo apt-key add - &&\ | ||
echo "deb [arch=amd64] https://packages.irods.org/apt/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/renci-irods.list | ||
# apt-get update --allow-insecure-repositories | ||
RUN apt-get update --allow-unauthenticated | ||
RUN apt-get install -y irods-externals-* | ||
RUN apt-get install -y irods-dev | ||
WORKDIR /opt | ||
# https://github.com/irods/externals?tab=readme-ov-file#rhel--centos-7 | ||
RUN git clone https://github.com/irods/externals.git &&\ | ||
cd externals &&\ | ||
./install_prerequisites.py &&\ | ||
make | ||
|
||
COPY . /hydroshare-quota | ||
# CMakeLists.txt must match iRODS version specified. This file is under version control. | ||
# cmake3.21 for iRODS 4.3.x | ||
# cmake3.11.4-0 for iRODS 4.2.x | ||
WORKDIR /hydroshare-quota | ||
RUN /opt/externals/cmake3.11.4-0/bin/cmake . | ||
RUN mkdir -p DEBAIN && touch DEBIAN/control | ||
SHELL ["/bin/bash", "-c"] | ||
RUN echo $'Package: hydroshare-quota \n\ | ||
Version: 999 \n\ | ||
Maintainer: CUAHSI \n\ | ||
Architecture: all \n\ | ||
Description: hydroshare-quota' > DEBIAN/control | ||
|
||
RUN dpkg-deb --build hydroshare-quota | ||
RUN mkdir /output && mv hydroshare-quota.deb /output/ | ||
|
||
# for local development: | ||
# docker cp hydroshare-quota.deb data.local.org:/root/ | ||
# cat <<EOF | docker exec --interactive data.local.org sh | ||
# dpkg -i /root/hydroshare-quota.deb | ||
# chmod -R 775 /etc/irods | ||
# EOF | ||
|
||
FROM alpine | ||
COPY --from=builder /output /output |