Skip to content

Commit

Permalink
simplified build process
Browse files Browse the repository at this point in the history
  • Loading branch information
joonas-fi committed Apr 5, 2022
1 parent cc22c05 commit 80c97cf
Show file tree
Hide file tree
Showing 12 changed files with 27 additions and 583 deletions.
63 changes: 0 additions & 63 deletions .github/workflows/main.yaml

This file was deleted.

46 changes: 5 additions & 41 deletions .github/workflows/tii-mocap-pose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,47 +2,17 @@ name: tii-mocap-pose

on:
push:
branches: main
tags:
- 'v*'
- v[0-9]+.[0-9]+.[0-9]+
- v[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+
pull_request:
branches: [ main ]

jobs:
tii-mocap-pose:
build:
runs-on: ubuntu-latest
services:
registry:
image: registry:2
ports:
- 5000:5000
steps:

- name: Checkout mocap_pose
uses: actions/checkout@v2
- uses: actions/checkout@v2
with:
submodules: recursive
submodules: true

- uses: docker/setup-buildx-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
driver-opts: network=host

- name: Build the builder container image
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile.build_env
push: true
tags: localhost:5000/tiiuae/mocap_pose:build_env
build-args: |
PACKAGE_NAME=mocap_pose
ROS_DISTRO=galactic
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
Expand All @@ -56,21 +26,15 @@ jobs:
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
if: github.event_name == 'push'
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build tii-mocap-pose image and push
- name: Build container image and push
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
push: ${{ github.event_name != 'pull_request' }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
PACKAGE_NAME=mocap_pose
ROS_DISTRO=galactic
FROM_IMAGE=localhost:5000/tiiuae/mocap_pose:build_env
54 changes: 21 additions & 33 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,33 +1,21 @@
# fog-sw BUILDER
ARG FROM_IMAGE
FROM $FROM_IMAGE as fog-sw-builder
ARG ROS_DISTRO="galactic"
ARG UID=1000
ARG GID=1000
ARG PACKAGE_NAME

WORKDIR /$PACKAGE_NAME/main_ws
USER root
ADD . /$PACKAGE_NAME/main_ws/src
RUN chown -R builder:builder /$PACKAGE_NAME/main_ws

USER builder

RUN if [ -e /$PACKAGE_NAME/deps_ws ]; then \
. /$PACKAGE_NAME/deps_ws/install/setup.sh && \
colcon build; \
elif [ -e /opt/ros/${ROS_DISTRO}/setup.sh ]; then \
. /opt/ros/${ROS_DISTRO}/setup.sh && \
colcon build; \
fi

RUN sed --in-place \
's|^source .*|source "/'$PACKAGE_NAME'/main_ws/install/setup.bash"|' \
/$PACKAGE_NAME/entrypoint.sh && \
chmod +x /$PACKAGE_NAME/entrypoint.sh

ENV PACKAGE_NAME $PACKAGE_NAME
ENV RMW_IMPLEMENTATION rmw_fastrtps_cpp

WORKDIR /$PACKAGE_NAME
ENTRYPOINT "/"$PACKAGE_NAME"/entrypoint.sh"
FROM ghcr.io/tiiuae/fog-ros-baseimage:builder-latest AS builder

COPY . /main_ws/src/

# this:
# 1) builds the application
# 2) packages the application as .deb in build_output/

# RUN /packaging/build-and-package-as-deb.sh -o build_output/
RUN /packaging/build.sh

# ▲ runtime ──┐
# └── build ▼

FROM ghcr.io/tiiuae/fog-ros-baseimage:sha-d2cdcdb

ENTRYPOINT exec ros-with-env ros2 launch mocap_pose mocap_pose.launch

COPY --from=builder /main_ws/ros-*-mocap-pose_*_amd64.deb /mocap-pose.deb

RUN dpkg -i /mocap-pose.deb && rm /mocap-pose.deb
45 changes: 0 additions & 45 deletions Dockerfile.build_env

This file was deleted.

40 changes: 0 additions & 40 deletions build.sh

This file was deleted.

6 changes: 0 additions & 6 deletions entrypoint.sh

This file was deleted.

51 changes: 0 additions & 51 deletions packaging/build_deps.sh

This file was deleted.

Loading

0 comments on commit 80c97cf

Please sign in to comment.