Skip to content

Commit 9364085

Browse files
authored
Create docker-build-image.yml
1 parent aa3a2ea commit 9364085

File tree

1 file changed

+77
-0
lines changed

1 file changed

+77
-0
lines changed
+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Build Docker image
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches: [ main ]
7+
tags:
8+
- '*'
9+
pull_request:
10+
branches: [ main ]
11+
12+
jobs:
13+
build-docker-image:
14+
if: github.repository_owner == 'LCAS'
15+
runs-on: lcas
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
include:
20+
- base_image: lcas.lincoln.ac.uk/lcas/ros:jammy-humble-cuda11.8-opengl
21+
ros_distro: humble
22+
push_image: lcas.lincoln.ac.uk/lcas/aoc_fruit_detector
23+
24+
steps:
25+
- name: Node Js
26+
uses: actions/setup-node@v4
27+
with:
28+
node-version: "^16.13.0 || >=18.0.0"
29+
- uses: de-vri-es/setup-git-credentials@v2
30+
with:
31+
credentials: ${{ secrets.LCAS_GITHUB_CREDENTIALS }}
32+
33+
- uses: actions/checkout@v3
34+
35+
- name: What
36+
run: echo "BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV
37+
38+
- name: Docker Login LCAS
39+
if: ${{ github.event_name != 'pull_request' }}
40+
uses: docker/login-action@v3
41+
with:
42+
registry: lcas.lincoln.ac.uk
43+
username: ${{ secrets.LCAS_REGISTRY_PUSHER }}
44+
password: ${{ secrets.LCAS_REGISTRY_TOKEN }}
45+
46+
- name: Docker meta
47+
id: meta_public
48+
uses: docker/metadata-action@v5
49+
with:
50+
# list of Docker images to use as base name for tags
51+
images: |
52+
${{ matrix.push_image }}
53+
54+
55+
- name: Build Public Docker Image
56+
uses: docker/build-push-action@v6
57+
with:
58+
context: .
59+
file: .devcontainer/docker/ros2/Dockerfile
60+
platforms: linux/amd64
61+
push: ${{ github.event_name != 'pull_request' }}
62+
tags: ${{ steps.meta_public.outputs.tags }}
63+
labels: ${{ steps.meta_public.outputs.labels }}
64+
target: user_space
65+
#tags: ${{ matrix.push_image }},${{ matrix.push_image }}-${{ env.BRANCH }}
66+
build-args: |
67+
BASE_IMAGE=${{ matrix.base_image }}
68+
BRANCH=${{ env.BRANCH }}
69+
ROS_DISTRO=${{ matrix.ros_distro }}
70+
71+
- name: Docker Login AOC
72+
if: ${{ github.event_name != 'pull_request' }}
73+
uses: docker/login-action@v3
74+
with:
75+
registry: aoccr.zrok.lcas.group
76+
username: ${{ secrets.AOC_REGISTRY_PUSHER }}
77+
password: ${{ secrets.AOC_REGISTRY_TOKEN }}

0 commit comments

Comments
 (0)