334df62651
- Adds a Dockerfile within this repository - GitHub actions to build and test the image
38 lines
1.2 KiB
YAML
38 lines
1.2 KiB
YAML
name: Build and Test Docker
|
|
on: [push, pull_request]
|
|
env:
|
|
CI_IMAGE: gollum-ci-img
|
|
jobs:
|
|
build-and-test:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Check Out Repo
|
|
uses: actions/checkout@v2
|
|
- name: Set up Docker Buildx
|
|
id: buildx
|
|
uses: docker/setup-buildx-action@v1
|
|
- name: Cache docker layers
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: /tmp/.buildx-cache
|
|
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
|
restore-keys: |
|
|
${{ runner.os }}-buildx-
|
|
- name: Build
|
|
id: docker_build
|
|
uses: docker/build-push-action@v2
|
|
with:
|
|
context: ./
|
|
file: ./Dockerfile
|
|
builder: ${{ steps.buildx.outputs.name }}
|
|
push: false
|
|
tags: ${{ env.CI_IMAGE }}
|
|
outputs: type=docker
|
|
cache-from: type=local,src=/tmp/.buildx-cache
|
|
cache-to: type=local,dest=/tmp/.buildx-cache
|
|
- name: Image digest
|
|
run: echo ${{ steps.docker_build.outputs.digest }}
|
|
- name: docker state
|
|
run: docker image ls
|
|
- name: Run tests
|
|
run: docker run -e CI=true -w /app --entrypoint bundle ${{ env.CI_IMAGE }} exec rake |