From d9f3c682d0681e7d1f566617aade4621f088a98a Mon Sep 17 00:00:00 2001 From: Christian Mehlmauer Date: Mon, 2 Aug 2021 12:16:00 +0200 Subject: [PATCH] docker build --- .github/workflows/docker.yml | 47 ++++++++++++++++++++++++++++++++++++ .ruby-version | 2 +- Dockerfile | 4 +-- 3 files changed, 50 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/docker.yml diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 00000000..2be36d06 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,47 @@ +name: Build Docker Images + +on: + push: + branches: + - master + release: + types: [published] + +jobs: + images: + runs-on: ubuntu-latest + + steps: + - name: checkout sources + uses: actions/checkout@v2.3.4 + + - name: Set tag to latest + if: github.event_name == 'push' && github.ref == 'refs/heads/master' + run: | + echo "DOCKER_TAG=latest" >> $GITHUB_ENV + + - name: Set tag to release name + if: github.event_name == 'release' && startsWith(github.ref, 'refs/tags/') + run: | + echo "DOCKER_TAG=${{ github.event.release.tag_name }}" >> $GITHUB_ENV + + - name: Check if DOCKER_TAG is set + if: env.DOCKER_TAG == "" + run: | + echo DOCKER_TAG is not set! + exit 1 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Login to Docker Hub + uses: docker/login-action@v1.10.0 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v2 + with: + push: true + tags: wpscanteam/wpscan:${{ env.DOCKER_TAG }} diff --git a/.ruby-version b/.ruby-version index 37c2961c..b5021469 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.7.2 +3.0.2 diff --git a/Dockerfile b/Dockerfile index bdc8c329..8bf83d5e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ruby:2.7.2-alpine AS builder +FROM ruby:3.0.2-alpine AS builder LABEL maintainer="WPScan Team " RUN echo "install: --no-document --no-post-install-message\nupdate: --no-document --no-post-install-message" > /etc/gemrc @@ -19,7 +19,7 @@ RUN rake install --trace RUN chmod -R a+r /usr/local/bundle -FROM ruby:2.7.2-alpine +FROM ruby:3.0.2-alpine LABEL maintainer="WPScan Team " LABEL org.opencontainers.image.source https://github.com/wpscanteam/wpscan