Skip to content

Commit

Permalink
Add workflow and update devcontainer to map .ssh folder
Browse files Browse the repository at this point in the history
  • Loading branch information
felmoltor committed Aug 20, 2024
1 parent d26bab0 commit 8808153
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
"build": {
"args": {}
},
"mounts": [
"source=${env:HOME}/.ssh,target=/root/.ssh,type=bind,consistency=cached"
],
"customizations": {
"vscode": {
"settings": {
Expand Down
64 changes: 64 additions & 0 deletions .github/workflows/publish-registry.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Publish Docker image and Create Release

permissions:
contents: write

on:
push:
tags:
- 'v*'

jobs:
publish:
runs-on: ubuntu-latest

env:
IMAGE_NAME: maitm # Define the image name variable

steps:
- name: Print Variables and Extract Git Tag
shell: bash
run: |
echo "ref_type: ${{github.ref_type}}"
echo "ref: ${{github.ref}}"
echo "base_ref: ${{github.base_ref}}"
echo "github.repository: ${{github.repository}}"
echo "GIT_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- name: Checkout code
uses: actions/checkout@v2

- name: Log in to GitHub Container Registry
run: echo "${{ secrets.GHCR_PAT }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin

- name: Build Docker image
run: |
docker build -t ghcr.io/${{ github.repository }}/${{env.IMAGE_NAME}}:${{ github.ref_name }} .
- name: Build Docker Image
run: |
docker build \
--build-arg VERSION=${{ env.GIT_TAG }} \
--build-arg GITHUB_SHA=${{ github.sha }} \
--build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') \
-t ghcr.io/${{ github.repository }}/${{env.IMAGE_NAME}}:${{ github.ref_name }} \
-t ghcr.io/${{ github.repository }}/${{env.IMAGE_NAME}}:latest \
.
- name: Push Docker image to GitHub Container Registry
run: |
docker push ghcr.io/${{ github.repository }}/${{env.IMAGE_NAME}}:${{ github.ref_name }}
docker push ghcr.io/${{ github.repository }}/${{env.IMAGE_NAME}}:latest
- name: Create GitHub Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Automatically provided by GitHub Actions
with:
tag_name: ${{ github.ref_name }} # Use the tag name as the release title
release_name: Release ${{ github.ref_name }}
body: |
This is the release of version ${{ github.ref_name }}.
draft: false
prerelease: false
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ dist
.pnp.*

.vscode
.github
config.yml
config*.yaml
forwardedemails.txt
Expand Down
15 changes: 14 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
FROM alpine:3.20
LABEL name="Maitm"


# Accept build arguments
ARG VERSION
ARG GITHUB_SHA
ARG BUILD_DATE

# Labels with dynamic values
LABEL "com.example.vendor"="Orange Cyberdefense Sensepost Team"
LABEL org.opencontainers.image.authors="Felipe Molina de la Torre"
LABEL org.opencontainers.image.authors="Felipe Molina de la Torre (@felmoltor)"
LABEL org.opencontainers.image.source="https://github.com/sensepost/mail-in-the-middle"
LABEL org.opencontainers.image.url="https://github.com/sensepost/mail-in-the-middle"
LABEL org.opencontainers.image.version=$VERSION
LABEL org.opencontainers.image.revision=$GITHUB_SHA
LABEL org.opencontainers.image.created=$BUILD_DATE

COPY *.py /Maitm/
COPY Pipfile /Maitm/
Expand Down

0 comments on commit 8808153

Please sign in to comment.