-
Notifications
You must be signed in to change notification settings - Fork 33
42 lines (42 loc) · 1.69 KB
/
docker-image.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#
# GitHub Actions configuration to automatically build and publish a Docker image
# for Omicron. See README for details.
#
name: docker-image
on: push
jobs:
docker-image:
runs-on: ubuntu-18.04
steps:
# actions/checkout@v2
- uses: actions/checkout@28c7f3d2b5162b5ddd3dfd9a45aa55eaf396478b
- name: Set up Docker 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: Login to GitHub Packages Docker Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract branch name
shell: bash
run: BRANCH="${GITHUB_HEAD_REF//\//-}"; echo "::set-output name=branch::${BRANCH:-main}"
id: extract_branch
- name: Build and push
# This pushes a docker image to github's container registry.
# It is not a public image by default.
# The docs are here: https://github.com/docker/build-push-action
uses: docker/build-push-action@9379083e426e2e84abb80c8c091f5cdeb7d3fd7a
with:
push: ${{ ! startsWith(github.ref, 'refs/heads/dependabot') }}
file: ./Dockerfile
tags: ghcr.io/${{ github.repository_owner }}/omicron:${{ steps.extract_branch.outputs.branch }},ghcr.io/${{ github.repository_owner }}/omicron:${{ github.sha }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache