Skip to content

CI

CI #500

Workflow file for this run

# This is a basic workflow to help you get started with Actions
name: CI
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ master ]
pull_request:
branches: [ master ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
inputs:
cleanupTag:
description: 'The tag for the Docker image'
required: true
default: 'tcpdumpCleanup'
tcpdumpTag:
description: 'The tag for the Docker image'
required: true
default: 'tcpdump'
Environment:
description: 'The environment to deploy to'
required: true
type: choice
options:
- prod
- staging
default: staging
Module:
description: 'The module'
required: true
type: choice
options:
- tcpdump
- tcpdumpCleanup
default: tcpdump
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: DockerHub login
if: ${{ github.event.inputs.Environment == 'prod' }}
env:
DOCKER_USERNAME: ${{secrets.DOCKER_USERNAME}}
DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}}
run: |
docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
- name: Build, tag, and push the image to DockerHub tcpdump cleanup
if: ${{ github.event.inputs.Environment == 'prod' && github.event.inputs.Module == 'tcpdumpCleanup'}}
id: build-image-dockerhub
env:
ECR_REGISTRY: aktosecurity
IMAGE_TAG: ${{ github.event.inputs.cleanupTag }}
run: |
# Build a docker container and push it to DockerHub
docker buildx create --use
docker buildx build --platform linux/arm64/v8,linux/amd64 -t $ECR_REGISTRY/mirror-api-logging:$IMAGE_TAG -f Dockerfile.cleanup . --push
echo "::set-output name=image::$ECR_REGISTRY/mirror-api-logging:$IMAGE_TAG"
- name: Build, tag, and push the image to DockerHub tcpdump
if: ${{ github.event.inputs.Environment == 'prod' && github.event.inputs.Module == 'tcpdump'}}
id: build-image-dockerhub-2
env:
ECR_REGISTRY: aktosecurity
IMAGE_TAG: ${{ github.event.inputs.tcpdumpTag }}
run: |
# Build a docker container and push it to DockerHub
docker buildx create --use
docker buildx build --platform linux/arm64/v8,linux/amd64 -t $ECR_REGISTRY/mirror-api-logging:$IMAGE_TAG -f Dockerfile.tcpdump . --push
echo "::set-output name=image::$ECR_REGISTRY/mirror-api-logging:$IMAGE_TAG"