diff --git a/.github/Dockerfile b/.github/Dockerfile new file mode 100644 index 00000000..c5a32366 --- /dev/null +++ b/.github/Dockerfile @@ -0,0 +1,35 @@ +FROM summerwind/actions-runner:v2.287.1-ubuntu-20.04 + +ARG build_date=unspecified + +LABEL org.opencontainers.image.title="Cisco-SDWAN" \ + org.opencontainers.image.description="Cisco SDWAN DevOps" \ + org.opencontainers.image.vendor="Cisco Systems" \ + org.opencontainers.image.created="${build_date}" \ + org.opencontainers.image.url="https://github.com/CiscoDevNet/sdwan-devops" + +RUN sudo apt-get update && sudo apt-get install -y \ + sshpass \ + python3-dev \ + libffi-dev \ + libxml2-dev \ + libxslt-dev \ + mkisofs + +COPY requirements.txt /tmp/requirements.txt +RUN pip3 install -r /tmp/requirements.txt + +WORKDIR /tmp +ARG terraform_version=0.13.7 +RUN wget --quiet https://releases.hashicorp.com/terraform/${terraform_version}/terraform_${terraform_version}_linux_amd64.zip +RUN unzip terraform_${terraform_version}_linux_amd64.zip +RUN sudo mv terraform /usr/bin +RUN rm terraform_${terraform_version}_linux_amd64.zip + +ENV ANSIBLE_HOST_KEY_CHECKING=false +ENV ANSIBLE_RETRY_FILES_ENABLED=false +ENV ANSIBLE_SSH_PIPELINING=true +ENV ANSIBLE_LOCAL_TMP=/tmp +ENV ANSIBLE_REMOTE_TMP=/tmp + +WORKDIR /ansible diff --git a/.github/workflows/publish-actions-runner.yml b/.github/workflows/publish-actions-runner.yml new file mode 100644 index 00000000..51e9a097 --- /dev/null +++ b/.github/workflows/publish-actions-runner.yml @@ -0,0 +1,55 @@ +name: Docker Publish + +on: + schedule: + - cron: '11 1 * * *' + push: + branches: [ master ] + # Publish semver tags as releases. + tags: [ '*.*.*' ] + pull_request: + branches: [ master ] + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }}/actions-runner + + +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + # Login against a Docker registry except on PR + # https://github.com/docker/login-action + - name: Log into registry ${{ env.REGISTRY }} + if: github.event_name != 'pull_request' + uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + # Extract metadata (tags, labels) for Docker + # https://github.com/docker/metadata-action + - name: Extract Docker metadata + id: meta + uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + + # Build and push Docker image with Buildx (don't push on PR) + # https://github.com/docker/build-push-action + - name: Build and push Docker image + uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc + with: + context: . + file: .github/Dockerfile + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }}