Skip to content

Commit

Permalink
fixed docker images
Browse files Browse the repository at this point in the history
  • Loading branch information
spenceradolph committed Apr 14, 2024
1 parent f95cd30 commit 8a651cc
Showing 1 changed file with 45 additions and 22 deletions.
67 changes: 45 additions & 22 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ env:
# Container registry the built container image will be pushed to
REGISTRY: ghcr.io

# Set the container image name to the Github repository name. (MythicAgents/apfell)
AGENT_IMAGE_NAME: ${{ github.repository }}

# Description label for the package in Github
IMAGE_DESCRIPTION: ${{ github.repository }} container for use with Mythic

Expand All @@ -39,7 +36,7 @@ env:

jobs:
# Builds the base container image and pushes it to the container registry
agent_build_amd:
agent_build_amd_api:
runs-on: ubuntu-latest
permissions:
contents: write
Expand All @@ -60,17 +57,32 @@ jobs:
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
# the following are unique to this job
- name: Lowercase the server container image name
run: echo "AGENT_IMAGE_NAME=${AGENT_IMAGE_NAME,,}" >> ${GITHUB_ENV}
- name: Build and push the server container image

- name: Build and push the server container image (api)
uses: docker/build-push-action@v5 # ref: https://github.com/marketplace/actions/build-and-push-docker-images
with:
context: Payload_Type/sliverapi
file: Payload_Type/sliverapi/Dockerfile
tags: |
${{ env.REGISTRY }}/${{ env.AGENT_IMAGE_NAME }}:${{ env.VERSION }}
${{ env.REGISTRY }}/${{ env.AGENT_IMAGE_NAME }}:latest
${{ env.REGISTRY }}/sliverapi:${{ env.VERSION }}
${{ env.REGISTRY }}/sliverapi:latest
push: ${{ github.ref_type == 'tag' }}
# These container metadata labels allow configuring the package in Github
# packages. The source will link the package to this Github repository
labels: |
org.opencontainers.image.source=${{ env.IMAGE_SOURCE }}
org.opencontainers.image.description=${{ env.IMAGE_DESCRIPTION }}
org.opencontainers.image.licenses=${{ env.IMAGE_LICENSE }}
platforms: linux/amd64

- name: Build and push the server container image (implant)
uses: docker/build-push-action@v5 # ref: https://github.com/marketplace/actions/build-and-push-docker-images
with:
context: Payload_Type/sliverimplant
file: Payload_Type/sliverimplant/Dockerfile
tags: |
${{ env.REGISTRY }}/sliverimplant:${{ env.VERSION }}
${{ env.REGISTRY }}/sliverimplant:latest
push: ${{ github.ref_type == 'tag' }}
# These container metadata labels allow configuring the package in Github
# packages. The source will link the package to this Github repository
Expand All @@ -93,23 +105,19 @@ jobs:
- name: Checkout the repository
uses: actions/checkout@v4 # ref: https://github.com/marketplace/actions/checkout

# update names to lowercase
- name: Lowercase the container image name
run: echo "AGENT_IMAGE_NAME=${AGENT_IMAGE_NAME,,}" >> ${GITHUB_ENV}

- name: Update config.json version for sliverapi
uses: jossef/[email protected]
with:
file: config.json
field: remote_images.sliverapi
value: ${{env.REGISTRY}}/${{env.AGENT_IMAGE_NAME}}:${{env.VERSION}}
value: ${{env.REGISTRY}}/sliverapi:${{env.VERSION}}

- name: Update config.json version for sliverimplant
uses: jossef/[email protected]
with:
file: config.json
field: remote_images.sliverimplant
value: ${{env.REGISTRY}}/${{env.AGENT_IMAGE_NAME}}:${{env.VERSION}}
value: ${{env.REGISTRY}}/sliverimplant:${{env.VERSION}}

# Push the changes to the Dockerfile
- name: Push the updated base Dockerfile image reference changes
Expand Down Expand Up @@ -158,17 +166,32 @@ jobs:
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
# the following are unique to this job
- name: Lowercase the server container image name
run: echo "AGENT_IMAGE_NAME=${AGENT_IMAGE_NAME,,}" >> ${GITHUB_ENV}
- name: Build and push the server container image

- name: Build and push the server container image (api)
uses: docker/build-push-action@v5 # ref: https://github.com/marketplace/actions/build-and-push-docker-images
with:
context: Payload_Type/sliverapi
file: Payload_Type/sliverapi/Dockerfile
tags: |
${{ env.REGISTRY }}/${{ env.AGENT_IMAGE_NAME }}:${{ env.VERSION }}
${{ env.REGISTRY }}/${{ env.AGENT_IMAGE_NAME }}:latest
${{ env.REGISTRY }}/sliverapi:${{ env.VERSION }}
${{ env.REGISTRY }}/sliverapi:latest
push: ${{ github.ref_type == 'tag' }}
# These container metadata labels allow configuring the package in Github
# packages. The source will link the package to this Github repository
labels: |
org.opencontainers.image.source=${{ env.IMAGE_SOURCE }}
org.opencontainers.image.description=${{ env.IMAGE_DESCRIPTION }}
org.opencontainers.image.licenses=${{ env.IMAGE_LICENSE }}
platforms: linux/arm64

- name: Build and push the server container image (implant)
uses: docker/build-push-action@v5 # ref: https://github.com/marketplace/actions/build-and-push-docker-images
with:
context: Payload_Type/sliverimplant
file: Payload_Type/sliverimplant/Dockerfile
tags: |
${{ env.REGISTRY }}/sliverimplant:${{ env.VERSION }}
${{ env.REGISTRY }}/sliverimplant:latest
push: ${{ github.ref_type == 'tag' }}
# These container metadata labels allow configuring the package in Github
# packages. The source will link the package to this Github repository
Expand Down

0 comments on commit 8a651cc

Please sign in to comment.