Skip to content

CI to publish docker images #9

CI to publish docker images

CI to publish docker images #9

name: Build and publish Docker Images
on:
push:
branches: [ "master" ]
paths:
- 'docker/enclave-base/**'
- 'docker/parent-base/**'
pull_request:
branches: [ "master" ]
paths:
- 'docker/enclave-base/**'
- 'docker/parent-base/**'
jobs:
build-docker-images:
runs-on: ubuntu-20.04
# if: github.event_name == 'pull_request' && github.event.action == 'opened'
steps:
- name: Pull main repository
uses: actions/checkout@v3
with:
repository: fortanix/salmiac
- name: Build docker images
run: |
cd docker/enclave-base
docker build -t fortanix/enclave-base .
docker save -o /tmp/enclave-base.tar fortanix/enclave-base
# cd ../parent-base
# docker build -t fortanix/parent-base .
- name: Upload enclave-base artifact
uses: actions/upload-artifact@v3
with:
name: enclave-base
path: /tmp/enclave-base.tar
push-docker-images:
runs-on: ubuntu-20.04
needs: build-docker-images
# if: github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true
steps:
- name: Download enclave-base artifact
uses: actions/download-artifact@v3
with:
name: enclave-base
path: /tmp/enclave-base
- name: Load enclave-base image
run: |
docker load --input /tmp/enclave-base/enclave-base.tar
- name: Download parent-base artifact
uses: actions/download-artifact@v3
with:
name: parent-base
path: /tmp/parent-base.tar
- name: Load parent-base image
run: |
docker load --input /tmp/parent-base.tar
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Push docker images
run: |
docker push fortanix/enclave-base
docker push fortanix/parent-base