Skip to content

Commit

Permalink
Add a seperate workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
doganulus committed Jul 22, 2024
1 parent c99d8bb commit d89b651
Show file tree
Hide file tree
Showing 2 changed files with 93 additions and 4 deletions.
78 changes: 78 additions & 0 deletions .github/workflows/builder-buildah-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Build Autoware builder container images using Buildah
on:
workflow_dispatch:
schedule:
- cron: '34 15 * * 0' # 15:34 UTC every Sunday
push:
paths:
- Dockerfile
- autoware.repos.yml
- .github/workflows/builder-buildah-build.yml # Self-trigger

env:
REGISTRY: ghcr.io
IMAGE_NAME: bounverif/autoware
AUTOWARE_VERSION: latest
TMPDIR: /var/lib/containers/tmp

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read
packages: write

jobs:
autoware-builder-build:
runs-on: ubuntu-24.04
steps:
- name: Maximize build space
uses: easimon/maximize-build-space@v10
with:
root-reserve-mb: 2048 # Reserve disk space for repository
remove-dotnet: 'true'
remove-android: 'true'
remove-haskell: 'true'
remove-codeql: 'true'
remove-docker-images: 'true'
build-mount-path: '/var/lib/containers' # The remaining space only for container build

- run: mkdir -p $TMPDIR

- name: Checkout repository
uses: actions/checkout@v4

- name: Set current date as the version
run: echo "AUTOWARE_VERSION=$(date +'%Y%m%d')" >> $GITHUB_ENV

- name: Buildah Action
id: build-image
uses: redhat-actions/buildah-build@v2
with:
platform: linux/amd64
image: ${{ env.IMAGE_NAME }}
tags: ${{ env.AUTOWARE_VERSION }}-builder latest
layers: true
oci: true
build-args: |
AUTOWARE_VERSION=${{ env.AUTOWARE_VERSION }}
extra-args:
--target autoware-builder
containerfiles: |
./Dockerfile
- name: Log in to the GitHub Container registry
uses: redhat-actions/podman-login@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# - name: Push to GitHub Container Repository
# id: push-to-ghcr
# uses: redhat-actions/push-to-registry@v2
# with:
# image: ${{ steps.build-image.outputs.image }}
# tags: ${{ steps.build-image.outputs.tags }}
# registry: ${{ env.REGISTRY }}
19 changes: 15 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ ARG CUDA_KEYRING_FILEPATH=https://developer.download.nvidia.com/compute/cuda/rep
RUN rm -f /etc/apt/apt.conf.d/docker-clean

RUN --mount=type=cache,target=/var/cache/apt,sharing=locked,id=${CACHEMOUNT_PREFIX}/var/cache/apt \
apt-get update && apt-get install -y --no-install-recommends \
export DEBIAN_FRONTEND=noninteractive && \
apt-get update && \
apt-get install -y --no-install-recommends \
sudo \
tini \
wget \
Expand Down Expand Up @@ -64,7 +66,9 @@ RUN wget -qO- "https://keyserver.ubuntu.com/pks/lookup?fingerprint=on&op=get&sea
FROM autoware-base AS autoware-source

RUN --mount=type=cache,target=/var/cache/apt,sharing=locked,id=${CACHEMOUNT_PREFIX}/var/cache/apt \
apt-get update && apt-get install -y --no-install-recommends \
export DEBIAN_FRONTEND=noninteractive && \
apt-get update && \
apt-get install -y --no-install-recommends \
git \
python3-minimal \
python3-vcstool \
Expand All @@ -77,7 +81,9 @@ RUN mkdir -p ${AUTOWARE_SOURCE_DIR} && vcs import --shallow ${AUTOWARE_SOURCE_DI
FROM autoware-base AS autoware-builder-nocuda

RUN --mount=type=cache,target=/var/cache/apt,sharing=locked,id=${CACHEMOUNT_PREFIX}/var/cache/apt \
apt-get update && apt-get install -y --no-install-recommends \
export DEBIAN_FRONTEND=noninteractive && \
apt-get update && \
apt-get install -y --no-install-recommends \
build-essential \
git \
cmake \
Expand All @@ -92,7 +98,10 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked,id=${CACHEMOUNT_PREF

RUN --mount=type=bind,from=autoware-source,source=${AUTOWARE_SOURCE_DIR},target=${AUTOWARE_SOURCE_DIR} \
--mount=type=cache,target=/var/cache/apt,sharing=locked,id=${CACHEMOUNT_PREFIX}/var/cache/apt \
rosdep init && apt update && rosdep update && \
export DEBIAN_FRONTEND=noninteractive && \
apt update && \
rosdep init && \
rosdep update && \
rosdep install -y \
--from-paths ${AUTOWARE_SOURCE_DIR} \
--ignore-src \
Expand All @@ -111,6 +120,7 @@ RUN mkdir -p ${CCACHE_DIR} && chmod 777 ${CCACHE_DIR}
FROM autoware-builder-nocuda AS autoware-builder

RUN --mount=type=cache,target=/var/cache/apt,sharing=locked,id=${CACHEMOUNT_PREFIX}/var/cache/apt \
export DEBIAN_FRONTEND=noninteractive && \
apt-get update && apt-get install -y --no-install-recommends \
cuda-minimal-build-12-4 \
libcublas-dev-12-4 \
Expand Down Expand Up @@ -193,6 +203,7 @@ ENV NVIDIA_VISIBLE_DEVICES=all
ENV NVIDIA_DRIVER_CAPABILITIES=compute,utility,graphics

RUN --mount=type=cache,target=/var/cache/apt,sharing=locked,id=${CACHEMOUNT_PREFIX}/var/cache/apt \
export DEBIAN_FRONTEND=noninteractive && \
apt-get update && apt-get install -y --no-install-recommends \
libcublas-12-4 \
libcurand-12-4 \
Expand Down

0 comments on commit d89b651

Please sign in to comment.