From 404bd81107ec8cf101def8c50d8559c0e3b3089f Mon Sep 17 00:00:00 2001 From: Shivam Kumar Date: Wed, 4 Sep 2024 15:01:53 +0530 Subject: [PATCH] Feat/enigma (#9) * Update Dockerfile * Update Dockerfile * testing enigma workflow * Update enigma-docker.yml * test * Update enigma-docker.yml * test * Update enigma-docker.yml * Update enigma-docker.yml * Update enigma-docker.yml removed commented lines * Update docker-scanner.yaml to 1.2.8 --------- Co-authored-by: Vishwajit Nagulkar <119565952+VishwajitNagulkar@users.noreply.github.com> --- .docker/Dockerfile | 6 ++-- .github/workflows/docker-scanner.yaml | 4 +-- .github/workflows/enigma-docker.yml | 45 +++++++++++++++++++++++++++ .github/workflows/sanity-check.yaml | 4 +-- 4 files changed, 52 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/enigma-docker.yml diff --git a/.docker/Dockerfile b/.docker/Dockerfile index 8f8d0db..3cc16f6 100644 --- a/.docker/Dockerfile +++ b/.docker/Dockerfile @@ -76,8 +76,8 @@ RUN apt install -y \ # ZSH -ADD ./etc/install-zsh.sh /root/install-zsh.sh -ADD ./etc/install-zsh.sh /home/ubuntu/install-zsh.sh +ADD .docker/etc/install-zsh.sh /root/install-zsh.sh +ADD .docker/etc/install-zsh.sh /home/ubuntu/install-zsh.sh RUN chmod +x /root/install-zsh.sh RUN chmod +x /home/ubuntu/install-zsh.sh @@ -183,4 +183,4 @@ WORKDIR /home/ubuntu/workspace # Define default command. EXPOSE 22 -CMD ["/usr/sbin/sshd", "-D"] \ No newline at end of file +CMD ["/usr/sbin/sshd", "-D"] diff --git a/.github/workflows/docker-scanner.yaml b/.github/workflows/docker-scanner.yaml index 2b76c5a..7e54626 100644 --- a/.github/workflows/docker-scanner.yaml +++ b/.github/workflows/docker-scanner.yaml @@ -15,8 +15,8 @@ on: jobs: docker-scanner: - uses: clouddrove/github-shared-workflows/.github/workflows/docker-scanner.yml@1.2.7 + uses: clouddrove/github-shared-workflows/.github/workflows/docker-scanner.yml@1.2.8 with: severity: "UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL" dockerfile-path: "./.docker/Dockerfile" - security-upload: "true" \ No newline at end of file + security-upload: "true" diff --git a/.github/workflows/enigma-docker.yml b/.github/workflows/enigma-docker.yml new file mode 100644 index 0000000..a566fba --- /dev/null +++ b/.github/workflows/enigma-docker.yml @@ -0,0 +1,45 @@ +name: Enigma Docker Build and Publish. +on: + push: + tags: [ v* ] + +jobs: + docker-build-publish: + runs-on: ubuntu-latest + permissions: + contents: 'read' + id-token: 'write' + env: + DOCKER_IMAGE: devops-machine + DOCKER_TAG: ghcr.io/${{ github.repository }}:${{ github.ref_name }} + PROVIDER: github + + steps: + - name: Checkout code + uses: actions/checkout@v4.1.7 + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build Docker Image + uses: clouddrove/enigma@v0.0.7 + with: + command: bake + DOCKER_IMAGE: ${{ env.DOCKER_IMAGE }} + DOCKER_TAG: ${{ env.DOCKER_TAG }} + DOCKERFILE_PATH: .docker/Dockerfile + GITHUB_USERNAME: ${{ github.actor }} + TOKEN: ${{ secrets.GITHUB }} + + - name: Publish Docker Image + uses: clouddrove/enigma@v0.0.7 + with: + command: publish + DOCKER_IMAGE: ${{ env.DOCKER_IMAGE }} + DOCKER_TAG: ${{ env.DOCKER_TAG }} + DOCKERFILE_PATH: .docker/Dockerfile + GITHUB_USERNAME: ${{ github.actor }} + TOKEN: ${{ secrets.GITHUB }} diff --git a/.github/workflows/sanity-check.yaml b/.github/workflows/sanity-check.yaml index 50cfe4e..9ea5d5e 100644 --- a/.github/workflows/sanity-check.yaml +++ b/.github/workflows/sanity-check.yaml @@ -15,8 +15,8 @@ jobs: uses: docker/setup-buildx-action@v3.6.1 - name: Build the application image - run: docker build -t clouddrove/devops:0.0.${{ github.run_number }} ./.docker/. - + run: docker build -t clouddrove/devops:0.0.${{ github.run_number }} -f .docker/Dockerfile . + - name: Bring container up and running run: docker run --name devops -d clouddrove/devops:0.0.${{ github.run_number }}