Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix docker nightly build #2643

Open
wants to merge 9 commits into
base: gz-sim9
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
.git
.github
.vscode
build
build_*
33 changes: 33 additions & 0 deletions .github/workflows/docker-nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: nightly docker image builds

on:
push:
schedule:
- cron: '0 6 * * *'

jobs:
main:
runs-on: ubuntu-latest
steps:
- uses: docker/setup-buildx-action@v3
with:
driver: docker
- uses: actions/checkout@v4
with:
repository: gazebosim/gz-sim
ref: gz-sim9
path: src
- name: build base image
uses: docker/build-push-action@v6
with:
file: src/docker/Dockerfile.base
context: src
tags: gz-sim:base
load: true
- name: build nightly image
uses: docker/build-push-action@v6
with:
file: src/docker/Dockerfile.nightly
build-contexts: |
gz-sim:base=docker-image://gz-sim:base
context: src
5 changes: 1 addition & 4 deletions docker/Dockerfile.base
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:focal
FROM ubuntu:noble

RUN apt-get update \
&& apt-get install -y \
Expand All @@ -10,6 +10,3 @@ RUN scripts/enable_stable.sh

COPY docker/scripts/install_common_deps.sh scripts/install_common_deps.sh
RUN scripts/install_common_deps.sh

COPY docker/scripts/enable_gcc8.sh scripts/enable_gcc8.sh
RUN scripts/enable_gcc8.sh
4 changes: 3 additions & 1 deletion docker/Dockerfile.nightly
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ RUN apt-get update \
libgz-gui9-dev \
libgz-msgs11-dev \
libgz-sensors9-dev \
libsdformat15-dev
libsdformat15-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

COPY . gz-sim
RUN cd gz-sim \
Expand Down
6 changes: 4 additions & 2 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ use the Gazebo code found in the current source tree.

1. [Install Docker](#Install-Docker)

You need at least 10GB or free space on a hard drive.

1. *Optional:* [Install NVidia Docker](#Install-Nvidia-Docker)

Nvidia docker will be needed if you plan to run the GUI and/or sensors
Expand Down Expand Up @@ -46,13 +48,13 @@ use the Gazebo code found in the current source tree.
3. Run the docker image with a bash shell.

```
docker run -it gz-sim:nightly /bin/bash
docker run --rm -it gz-sim:nightly /bin/bash
```

4. Alternatively, you can directly run Gazebo using

```
./docker/run.bash gz-sim:nightly gz-sim-server -v 4
./docker/run.bash gz-sim:nightly gz sim -v 4
azeey marked this conversation as resolved.
Show resolved Hide resolved
```

## Gazebo Using Debians In Docker
Expand Down
13 changes: 2 additions & 11 deletions docker/run.bash
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,8 @@ ARGS=("$@")
# This is necessary so Gazebo can create a context for OpenGL rendering
# (even headless).
XAUTH=/tmp/.docker.xauth
if [ ! -f $XAUTH ]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this change necessary?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, previous code not working, here is example on a system with empty /tmp:

xauth:  /tmp/.docker.xauth not writable, changes will be ignored
xauth: (argv):1:  unable to read any entries from file "(stdin)"
chmod: changing permissions of '/tmp/.docker.xauth': Operation not permitted
Authorization required, but no authorization protocol specified

and previous code somehow creates /tmp/.docker.xauth as a directory

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@j-rivero any thoughts on this?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It still quite simple to verify. But results can be false positive (it will be mentioned above error, but gui will work) if xhost +local was executed before (not sure, maybe it should be local:root, it's still part of ancient magic)

then
xauth_list=$(xauth nlist :0 | sed -e 's/^..../ffff/')
if [ ! -z "$xauth_list" ]
then
echo $xauth_list | xauth -f $XAUTH nmerge -
else
touch $XAUTH
fi
chmod a+r $XAUTH
fi
xauth nlist $DISPLAY | sed -e 's/^..../ffff/' | xauth -f $XAUTH nmerge -
chmod 777 $XAUTH

docker run -it \
-e DISPLAY \
Expand Down
17 changes: 0 additions & 17 deletions docker/scripts/enable_gcc8.sh

This file was deleted.

15 changes: 8 additions & 7 deletions docker/scripts/install_common_deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,17 @@ sudo apt-get install --no-install-recommends -y \
cppcheck \
curl \
git \
g++-8 \
pkg-config \
g++ \
lcov \
pkg-config

sudo apt-get install --no-install-recommends -y \
clang-tidy-6.0 \
python-yaml \
libclang-6.0-dev
clang-tidy \
python3-yaml

sudo apt-get install --no-install-recommends -y \
libbenchmark-dev \
libbenchmark1
libbenchmark1.8.3

sudo apt-get clean && sudo rm -rf /var/lib/apt/lists/*
sudo apt-get clean
sudo rm -rf /var/lib/apt/lists/*