Skip to content

feat: landingpage

feat: landingpage #9

Workflow file for this run

name: build and deploy DEVELOPMENT docker image
on:
push:
branches:
- main
workflow_dispatch:
env:
CR: 'ghcr.io'
CR_USER: ${{ secrets.CR_USER }}
CR_PAT: ${{ secrets.CR_PAT }}
GITHUB_REPO: ${{ github.repository }}
GITHUB_URL: ${{ github.server_url }}/${{ github.repository }}/actions/
GITHUB_ACTIONS_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
IMAGE_NAME_RAW: 'ghcr.io/${{ github.repository }}:latest'
APP_NAME: ${{ github.event.repository.name }}
jobs:
build:
name: Build
runs-on: ubuntu-20.04
timeout-minutes: 30
steps:
- name: checkout code
uses: actions/checkout@v2
- name: lowercase image name
run: |
IMAGE_NAME_LOWERCASE=`echo "${{ env.IMAGE_NAME_RAW }}" | awk '{print tolower($0)}'` >> ${GITHUB_ENV}
echo "IMAGE_NAME=$IMAGE_NAME_LOWERCASE" >> ${GITHUB_ENV}
echo "$IMAGE_NAME_LOWERCASE" >> IMAGE_NAME.txt
- name: filtering environment variables
run: |-
ls -al deployment/config/
chmod +x -R deployment/config/
deployment/config/env-filter.sh
- name: login to CR
run: |-
echo ${{ env.CR_PAT }} | docker login ghcr.io -u ${{ env.CR_USER }} --password-stdin
- name: building docker image
run: |-
docker build -t ${{ env.IMAGE_NAME }} .
- name: publish docker image
run: |-
docker push ${{ env.IMAGE_NAME }}
- name: logout from CR
run: |-
docker logout
- name: trivy vulnerability scanner
id: trivy_install
run: |-
wget https://github.com/aquasecurity/trivy/releases/download/v0.18.3/trivy_0.18.3_Linux-64bit.deb
sudo dpkg -i trivy_0.18.3_Linux-64bit.deb
- name: Run Trivy vulnerability scanner
id: trivy_run
run: |-
result=`GITHUB_TOKEN=${{ env.CR_PAT }} trivy fs --security-checks vuln .`
echo "$result" > result.txt
total=`echo "$result" | awk '/Total:/{print}'`
if [ "$total" ]; then
echo $total > result2.txt
echo "%0A" >> result2.txt
echo "Log: ${{ env.GITHUB_ACTIONS_URL }}" >> result2.txt
awk '$1=$1' ORS='%0A' result2.txt > result3.txt
sed -i "s| |%20|g" result3.txt
cat result3.txt
echo ${{ env.GITHUB_REPO }} >> intro.txt
echo ${{ env.TELEGRAM_CHAT_ID }} > chat_id
echo ${{ env.TELEGRAM_BOT_ID }} > bot_id
chmod +x deployment/config/trivy.sh
./deployment/config/trivy.sh
fi
- name: upload trivy artifact
uses: actions/upload-artifact@v3
with:
name: trivy
path: result.txt
- name: upload image name artifact
uses: actions/upload-artifact@v3
with:
name: IMAGE_NAME
path: IMAGE_NAME.txt
- name: cleaning
run: |-
rm -rf result.txt
rm -rf result2.txt
rm -rf intro.txt
rm -rf chat_id
rm -rf bot_id