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

Add python client image in workflow #3

Merged
merged 7 commits into from
Feb 2, 2024
Merged
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
46 changes: 39 additions & 7 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ jobs:
file: Util/Docker/Carla.Dockerfile
tags: rwthika/carla-simulator:source${{env.IMAGE_TAG_SUFFIX}}
no-cache: true
push: false
context: .
push: true

# provide artifacts and releases
provide-artifacts:
Expand Down Expand Up @@ -113,11 +113,43 @@ 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: .
push: true

# 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 +163,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 +191,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
1 change: 1 addition & 0 deletions CARLOS_CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* Update to Ubuntu 22.04 and Python 3.10 for prerequisites image
* Update to Ubuntu 22.04 and Python 3.10 for release image
* Created `vulkan-base` Dockerfile to replace discontinued `nvidia/vulkan` images used for the release image
* Created `client` Dockerfile to provide PythonAPI client image
* Added health check to release image

### Minor changes
Expand Down
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 "$@"
Loading