forked from lucidvisionlabs/arena_camera_ros
-
Notifications
You must be signed in to change notification settings - Fork 0
100 lines (86 loc) · 2.62 KB
/
docker.yaml
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
name: Build Docker Images
on:
push:
branches: [main]
workflow_dispatch:
pull_request:
paths:
- .docker/**
- .github/workflows/docker.yaml
# schedule:
# - cron: "0 17 * * 6"
env:
PUSH: ${{ (github.event_name != 'pull_request') && (github.repository == 'apl-ocean-engineering/arena_camera_ros') }}
jobs:
docker_build:
strategy:
fail-fast: false
matrix:
ROS_DISTRO: [noetic]
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v3
# Need the docker-container driver to export to cache
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
driver: docker-container
install: true # Set "docker build" == "docker buildx"
- name: Log into registry
if: env.PUSH == 'true'
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
#
# Build CI image
#
- name: Docker metadata for CI image
if: env.PUSH == 'true'
id: ci_meta
uses: docker/[email protected]
with:
images: ghcr.io/${{ github.repository }}/ci
tags: |
type=raw,value=${{ matrix.ROS_DISTRO }}
- name: Build and push the build stage "ci"
if: env.PUSH == 'true'
uses: docker/[email protected]
with:
context: .docker
file: .docker/Dockerfile
build-args: ROS_DISTRO=${{ matrix.ROS_DISTRO }}
target: ci
tags: ${{ steps.ci_meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
push: ${{ env.PUSH }}
cache-from: type=gha
cache-to: type=gha,mode=max
#
# Build complete image
#
- name: Docker metadata for final image
if: env.PUSH == 'true'
id: meta
uses: docker/[email protected]
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=raw,value=${{ matrix.ROS_DISTRO }}-latest
type=raw,value=latest
- name: Build and push full image
uses: docker/[email protected]
with:
context: .docker
file: .docker/Dockerfile
build-args: ROS_DISTRO=${{ matrix.ROS_DISTRO }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
push: ${{ env.PUSH }}
platforms: linux/amd64,linux/arm64
cache-from: type=gha