|
| 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 | + |
| 30 | + - uses: actions/checkout@v3 |
| 31 | + |
| 32 | + - name: What |
| 33 | + run: echo "BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV |
| 34 | + |
| 35 | + - name: Docker Login LCAS |
| 36 | + if: ${{ github.event_name != 'pull_request' }} |
| 37 | + uses: docker/login-action@v3 |
| 38 | + with: |
| 39 | + registry: lcas.lincoln.ac.uk |
| 40 | + username: ${{ secrets.LCAS_REGISTRY_PUSHER }} |
| 41 | + password: ${{ secrets.LCAS_REGISTRY_TOKEN }} |
| 42 | + |
| 43 | + - name: Docker meta |
| 44 | + id: meta_public |
| 45 | + uses: docker/metadata-action@v5 |
| 46 | + with: |
| 47 | + # list of Docker images to use as base name for tags |
| 48 | + images: | |
| 49 | + ${{ matrix.push_image }} |
| 50 | + tags: | |
| 51 | + type=ref,event=branch,pattern=main |
| 52 | + latest |
| 53 | +
|
| 54 | + - name: Build Public Docker Image |
| 55 | + uses: docker/build-push-action@v6 |
| 56 | + with: |
| 57 | + context: . |
| 58 | + file: .devcontainer/Dockerfile |
| 59 | + platforms: linux/amd64 |
| 60 | + push: ${{ github.event_name != 'pull_request' }} |
| 61 | + tags: ${{ steps.meta_public.outputs.tags }} |
| 62 | + labels: ${{ steps.meta_public.outputs.labels }} |
| 63 | + target: user_space |
| 64 | + #tags: ${{ matrix.push_image }},${{ matrix.push_image }}-${{ env.BRANCH }} |
| 65 | + build-args: | |
| 66 | + BASE_IMAGE=${{ matrix.base_image }} |
| 67 | + BRANCH=${{ env.BRANCH }} |
| 68 | + ROS_DISTRO=${{ matrix.ros_distro }} |
| 69 | +
|
| 70 | + - name: Docker Login AOC |
| 71 | + if: ${{ github.event_name != 'pull_request' }} |
| 72 | + uses: docker/login-action@v3 |
| 73 | + with: |
| 74 | + registry: aoccr.zrok.lcas.group |
| 75 | + username: ${{ secrets.AOC_REGISTRY_PUSHER }} |
| 76 | + password: ${{ secrets.AOC_REGISTRY_TOKEN }} |
0 commit comments