Skip to content

Commit

Permalink
add create-carla-client-image workflow job
Browse files Browse the repository at this point in the history
  • Loading branch information
cgeller committed Feb 1, 2024
1 parent b525e90 commit 8de3eff
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 6 deletions.
43 changes: 37 additions & 6 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,42 @@ jobs:
artifacts: artifacts/PythonAPI.tar.gz
token: ${{ secrets.PAT }}

# create vulkan-base for carla release
# create carla client image
create-carla-client-image:
name: Create carla client image
runs-on: self-hosted
needs: provide-artifacts
env:
IMAGE_TAG_SUFFIX: ""

steps:

- name: Set image tag
run: |
echo "IMAGE_TAG_SUFFIX=_$(echo '${{ github.ref_name }}' | tr / -)_ci" >> $GITHUB_ENV
if: github.ref_name != github.event.repository.default_branch

- uses: docker/login-action@v3
name: Login to Docker Hub
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- uses: docker/build-push-action@v5
name: Build and push image
with:
file: Util/Docker/client/Client.Dockerfile
tags: rwthika/carla-simulator:client${{env.IMAGE_TAG_SUFFIX}}
no-cache: true
build-args: |
UBUNTU_VERSION=22.04
context: .

# create vulkan-base for carla server image
create-vulkan-base-image:
name: Create vulkan-base image
runs-on: self-hosted
needs: provide-artifacts
needs: create-carla-client-image
steps:

- uses: docker/build-push-action@v5
Expand All @@ -131,9 +162,9 @@ jobs:
CUDA_VERSION=12.2.0
context: Util/Docker/vulkan-base

# create and push carla image
create-carla-image:
name: Create carla image
# create and push carla server image
create-carla-server-image:
name: Create carla server image
runs-on: self-hosted
needs: create-vulkan-base-image
env:
Expand All @@ -159,7 +190,7 @@ jobs:
name: Build and push
with:
file: build/Dockerfile
tags: rwthika/carla-simulator:latest${{env.IMAGE_TAG_SUFFIX}}
tags: rwthika/carla-simulator:server${{env.IMAGE_TAG_SUFFIX}}
no-cache: true
context: build
push: true
54 changes: 54 additions & 0 deletions Util/Docker/client/Client.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
ARG UBUNTU_VERSION="22.04"

FROM "ubuntu:${UBUNTU_VERSION}" as dependencies

USER root
SHELL ["/bin/bash", "-c"]

ARG CARLA_API_PATH=/opt/carla/PythonAPI

# Install essentials
RUN apt-get update && \
apt-get install -y \
fontconfig \
x11-apps \
python3-pip \
libomp5 \
libjpeg-turbo8 libtiff-dev \
libgeos-dev \
&& rm -rf /var/lib/apt/lists/*

RUN pip3 install --upgrade pip
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 10

# Move over PythonAPI
COPY ./artifacts/PythonAPI ${CARLA_API_PATH}

# Recursively install PythonAPI requirements, keep version of first occurrence
RUN cat $(find ${CARLA_API_PATH} -type f -name "requirements.txt") > /tmp/requirements_raw.txt \
&& awk -F '==' '{print $1}' /tmp/requirements_raw.txt | awk '!visited[$1]++' > /tmp/requirements.txt \
&& pip3 install -r /tmp/requirements.txt

# Create script that adds API to pythonpath and make .bashrc source it
RUN echo "export PYTHONPATH=\$PYTHONPATH:$CARLA_API_PATH/carla/dist/$(ls $CARLA_API_PATH/carla/dist | grep py$(python --version | awk -F'[ .]' '{print $2"."$3}').)" >> /setup_carla_env.sh; \
echo "export PYTHONPATH=\$PYTHONPATH:$CARLA_API_PATH/carla/agents" >> /setup_carla_env.sh; \
echo "export PYTHONPATH=\$PYTHONPATH:$CARLA_API_PATH/carla" >> /setup_carla_env.sh; \
echo "export CARLA_API_PATH=$CARLA_API_PATH" >> /setup_carla_env.sh; \
echo "source /setup_carla_env.sh" >> ~/.bashrc


# Needed for (pygame based) scripts that have a GUI
ENV SDL_VIDEODRIVER=x11

USER root
SHELL ["/bin/bash", "-c"]

ARG WORKSPACE=${CARLA_API_PATH}
ENV WORKSPACE=${WORKSPACE}
WORKDIR ${WORKSPACE}

# Set entrypoint
COPY ./Util/Docker/client/entrypoint.sh /
ENTRYPOINT [ "/entrypoint.sh" ]

CMD [ "python3", "util/test_connection.py" ]
8 changes: 8 additions & 0 deletions Util/Docker/client/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash
set -e

# source CARLA environment setup script
source /setup_carla_env.sh

# run the actual command
exec "$@"

0 comments on commit 8de3eff

Please sign in to comment.