Skip to content

Commit 9e20377

Browse files
committed
Preliminary Dockerfile for testing.
1 parent c95995a commit 9e20377

File tree

2 files changed

+92
-0
lines changed

2 files changed

+92
-0
lines changed

.docker/Dockerfile

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
ARG UBUNTU_VERSION=focal
2+
3+
#====================================================================
4+
# Preliminary image with dependencies
5+
#====================================================================
6+
#
7+
## This should work on both amd64 and arm64 through the magic of multi-arch?
8+
FROM ubuntu:${UBUNTU_VERSION} AS deps
9+
10+
ARG DEBIAN_FRONTEND=noninteractive
11+
12+
RUN apt-get update && apt-get install -y \
13+
cmake \
14+
gcc \
15+
git \
16+
libboost1.71-all-dev \
17+
python3 \
18+
python3-apt \
19+
python3-distutils \
20+
python3-pip \
21+
python-is-python3 \
22+
&& apt autoremove -y \
23+
&& apt clean -y \
24+
&& rm -rf /var/lib/apt/lists/*
25+
26+
#RUN pip3 install distutils
27+
28+
#====================================================================
29+
# Intermediate image with prereq steps for running in CI
30+
#====================================================================
31+
FROM deps as ci
32+
33+
## ~~ Create non-root user ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
34+
ARG USERNAME=apl
35+
ARG USER_UID=1000
36+
ARG USER_GID=$USER_UID
37+
38+
RUN groupadd --gid $USER_GID $USERNAME \
39+
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \
40+
#
41+
# [Optional] Add sudo support. Omit if you don't need to install software after connecting.
42+
&& apt-get update \
43+
&& apt-get install -y sudo \
44+
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
45+
&& chmod 0440 /etc/sudoers.d/$USERNAME
46+
47+
USER $USERNAME
48+
WORKDIR /home/apl
49+
50+
CMD ["/bin/bash"]
51+
52+
#====================================================================
53+
# Intermediate image with cloned Git repos
54+
#====================================================================
55+
FROM ci as git_checkout
56+
57+
ARG WS_DIR=/home/$USERNAME/ros_ws
58+
ONBUILD WORKDIR ${WS_DIR}/src
59+
60+
ARG LIBOCULUS_REPO=https://github.com/apl-ocean-engineering/liboculus.git
61+
ARG LIBOCULUS_BRANCH=main
62+
ONBUILD RUN echo "Cloning from ${LIBOCULUS_BRANCH} branch ${LIBOCULUS_ROS_REPO}"
63+
64+
ONBUILD RUN git clone --depth 1 -b ${LIBOCULUS_BRANCH} ${LIBOCULUS_REPO}
65+
66+
#====================================================================
67+
# Final image with built ROS packages
68+
#====================================================================
69+
# dockerfile_lint - ignore
70+
FROM git_checkout as liboculus
71+
72+
ARG WS_DIR
73+
LABEL Version=0.1
74+
LABEL Name=arena_camera_ros
75+
76+
WORKDIR ${WS_DIR}/liboculus
77+
RUN ./fips build

.docker/docker-compose.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
## Start a development stack with the current repo mounted into ros_ws/src/
2+
3+
version: "3.9"
4+
services:
5+
ci:
6+
build:
7+
dockerfile: Dockerfile
8+
target: ci
9+
image: ghcr.io/apl-ocean-engineering/liboculus/liboculus:latest
10+
stdin_open: true
11+
tty: true
12+
volumes:
13+
- type: bind
14+
source: ..
15+
target: /home/apl/liboculus

0 commit comments

Comments
 (0)