Skip to content

Commit

Permalink
auto build repo?
Browse files Browse the repository at this point in the history
  • Loading branch information
digininja committed May 3, 2024
1 parent 1ca7903 commit a00e344
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,18 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Build the Docker image
run: docker build . --file Dockerfile --tag my-image-name:$(date +%s)
run:
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/dvwa
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
[ "$VERSION" == "master" ] && VERSION=latest
COMMIT=$(echo "${{ github.sha }}" | cut -c 1-7)
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
echo COMMIT=$COMMIT
docker image build --tag dvwa .
docker image tag dvwa $IMAGE_ID:$VERSION
docker image tag dvwa $IMAGE_ID:$COMMIT
docker image push $IMAGE_ID:$VERSION
docker image push $IMAGE_ID:$COMMIT

0 comments on commit a00e344

Please sign in to comment.