Skip to content

Commit

Permalink
Add bits for actions-runner (#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonking3 authored Feb 14, 2022
1 parent 47c0afc commit 8ef6a9a
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .github/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
55 changes: 55 additions & 0 deletions .github/workflows/publish-actions-runner.yml
Original file line number Diff line number Diff line change
@@ -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 }}

0 comments on commit 8ef6a9a

Please sign in to comment.