Skip to content

Change docker file reference to mythicagents #2

Change docker file reference to mythicagents

Change docker file reference to mythicagents #2

Workflow file for this run

name: Build and push the base container image
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
IMAGE_DESCRIPTION: "Base container image for the Thanatos Mythic C2 agent"
IMAGE_SOURCE: https://github.com/${{ github.repository }}
IMAGE_LICENSE: BSD-3-Clause
jobs:
verify-tag:
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v4
- name: Lowercase the container image name
run: echo "IMAGE_NAME=${IMAGE_NAME,,}" >> ${GITHUB_ENV}
- name: Verify the Dockerfile references the correct image url
working-directory: Payload_Type/thanatos
run: |
grep "^FROM ${REGISTRY}/${IMAGE_NAME}:${GITHUB_REF_NAME}$" Dockerfile || (echo "Dockerfile reference does not match ${REGISTRY}/${IMAGE_NAME}:${GITHUB_REF_NAME}"; exit 1)
build-and-push-image:
runs-on: ubuntu-latest
needs: verify-tag
permissions:
contents: read
packages: write
steps:
- name: Checkout the repository
uses: actions/checkout@v4
- name: Log in to the container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Lowercase the container image name
run: echo "IMAGE_NAME=${IMAGE_NAME,,}" >> ${GITHUB_ENV}
- name: Build and push the container image
uses: docker/build-push-action@v5
with:
context: Payload_Type/thanatos
file: Payload_Type/thanatos/.docker/Dockerfile
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }}
push: true
labels: |
org.opencontainers.image.source=${{ env.IMAGE_SOURCE }}
org.opencontainers.image.description=${{ env.IMAGE_DESCRIPTION }}
org.opencontainers.image.licenses=${{ env.IMAGE_LICENSE }}