Docker images #2424
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
# This Software (Dioptra) is being made available as a public service by the | |
# National Institute of Standards and Technology (NIST), an Agency of the United | |
# States Department of Commerce. This software was developed in part by employees of | |
# NIST and in part by NIST contractors. Copyright in portions of this software that | |
# were developed by NIST contractors has been licensed or assigned to NIST. Pursuant | |
# to Title 17 United States Code Section 105, works of NIST employees are not | |
# subject to copyright protection in the United States. However, NIST may hold | |
# international copyright in software created by its employees and domestic | |
# copyright (or licensing rights) in portions of software that were assigned or | |
# licensed to NIST. To the extent that NIST holds copyright in this software, it is | |
# being made available under the Creative Commons Attribution 4.0 International | |
# license (CC BY 4.0). The disclaimers of the CC BY 4.0 license apply to all parts | |
# of the software developed or licensed by NIST. | |
# | |
# ACCESS THE FULL CC BY 4.0 LICENSE HERE: | |
# https://creativecommons.org/licenses/by/4.0/legalcode | |
name: Docker images | |
on: | |
schedule: | |
- cron: "0 3 * * *" # everyday at 3am | |
push: | |
branches: | |
- "main" | |
- "dev" | |
tags: | |
- "*.*.*" | |
pull_request: | |
branches: | |
- "main" | |
- "dev" | |
env: | |
PROJECT_PREFIX: dioptra | |
jobs: | |
build-docker-dioptra-apps: | |
runs-on: ubuntu-22.04 | |
if: ${{ false }} # disable for now | |
strategy: | |
matrix: | |
dioptra-app: | |
- nginx | |
- mlflow-tracking | |
- restapi | |
- pytorch-cpu | |
- pytorch-gpu | |
- tensorflow2-cpu | |
- tensorflow2-gpu | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/remove-extra-software | |
- name: set docker metadata | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
${{ env.PROJECT_PREFIX }}/${{ matrix.dioptra-app }} | |
tags: | | |
type=schedule,pattern=nightly | |
type=schedule,prefix=nightly-,pattern={{date 'YYYYMMDD'}} | |
type=ref,event=branch | |
type=ref,event=pr | |
type=ref,event=tag | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=semver,pattern={{major}},enable=${{ !startsWith(github.ref, 'refs/tags/v0.') }} | |
type=sha,format=long,prefix=,suffix= | |
labels: | | |
org.opencontainers.image.title=${{ matrix.dioptra-app }} | |
org.opencontainers.image.description=Provides the ${{ matrix.dioptra-app }} microservice within the Dioptra architecture. | |
org.opencontainers.image.vendor=National Institute of Standards and Technology | |
org.opencontainers.image.licenses=NIST-PD OR CC-BY-4.0 | |
org.opencontainers.image.documentation=https://pages.nist.gov/dioptra | |
org.opencontainers.image.authors=NCCoE Artificial Intelligence Team <[email protected]> | |
- name: set up docker qemu | |
uses: docker/setup-qemu-action@v3 | |
- name: set up docker buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: build and push | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
target: final | |
push: false | |
load: true | |
file: docker/Dockerfile.${{ matrix.dioptra-app }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
no-cache: true | |
pull: true | |
- name: create 'dev' tag | |
run: | | |
docker tag ${{ env.PROJECT_PREFIX }}/${{ matrix.dioptra-app }}:${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }} ${{ env.PROJECT_PREFIX }}/${{ matrix.dioptra-app }}:dev | |
- name: export dev-tagged image to tar.gz file | |
shell: bash | |
run: | | |
docker save ${{ env.PROJECT_PREFIX }}/${{ matrix.dioptra-app }}:dev | gzip > /tmp/${{ env.PROJECT_PREFIX }}_${{ matrix.dioptra-app }}_dev.tar.gz | |
- name: archive the testing images | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.PROJECT_PREFIX }}-${{ matrix.dioptra-app }}-dev-image | |
path: /tmp/${{ env.PROJECT_PREFIX }}_${{ matrix.dioptra-app }}_dev.tar.gz |