This repository has been archived by the owner on Jun 11, 2024. It is now read-only.
Deprecated update. #28
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: latest | |
on: | |
pull_request: | |
push: | |
branches: | |
- master | |
# schedule: | |
# - cron: '5 4 * * 0' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out git repository. | |
uses: actions/checkout@v2 | |
- name: Build the docker container | |
run: docker build -t docker-test . | |
- name: Test the docker container runs. | |
run: docker run --name docker-container -d --privileged -v /sys/fs/cgroup:/sys/fs/cgroup:rw --cgroupns=host docker-test | |
- name: Check ansible is availble inside the container. | |
run: docker exec --tty docker-container env TERM=xterm ansible --version | |
# If on master branch, push to Docker Hub. | |
push: | |
runs-on: ubuntu-latest | |
needs: build | |
if: github.ref == 'refs/heads/master' | |
# For further details on the below see; | |
# https://github.com/docker/build-push-action#multi-platform-image & | |
# https://docs.github.com/en/free-pro-team@latest/actions/reference/context-and-expression-syntax-for-github-actions#contexts | |
steps: | |
- name: Check out git repository. | |
uses: actions/checkout@v2 | |
- name: Setup QEMU. | |
uses: docker/setup-qemu-action@v1 | |
- name: Setup buildx. | |
uses: docker/setup-buildx-action@v1 | |
- name: Login to Docker Hub. | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME}} | |
password: ${{ secrets.DOCKER_HUB_PASSWORD}} | |
- name: Build and push. | |
uses: docker/build-push-action@v2 | |
with: | |
context: ./ | |
file: Dockerfile | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: ${{ github.repository }}:latest |