From 808df55df04bde5ade20a4215597d4fd0443b6a4 Mon Sep 17 00:00:00 2001 From: aestene Date: Tue, 20 Sep 2022 09:42:41 +0200 Subject: [PATCH] Publish image of ISAR with turtlebot --- .github/workflows/publish_docker_image.yml | 38 ++++++++++++++++++++-- Dockerfile.Isar | 10 ++++++ Dockerfile => Dockerfile.Simulator | 0 README.md | 2 +- docker-compose.yml | 2 +- 5 files changed, 48 insertions(+), 4 deletions(-) create mode 100644 Dockerfile.Isar rename Dockerfile => Dockerfile.Simulator (100%) diff --git a/.github/workflows/publish_docker_image.yml b/.github/workflows/publish_docker_image.yml index 7f95462..e4fbd74 100644 --- a/.github/workflows/publish_docker_image.yml +++ b/.github/workflows/publish_docker_image.yml @@ -12,13 +12,14 @@ name: Create and publish a Docker image on: release: types: [published] + workflow_dispatch: env: REGISTRY: ghcr.io IMAGE_NAME: ${{ github.repository }} jobs: - build-and-push-image: + build-and-push-simulator: runs-on: ubuntu-latest permissions: contents: read @@ -39,12 +40,45 @@ jobs: id: meta uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-simulator - name: Build and push Docker image uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc with: context: . + file: Dockerfile.Simulator + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + + build-and-push-isar-with-turtlebot: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Log in to the Container registry + uses: docker/login-action@v2 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v4 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + + - name: Build and push Docker image + uses: docker/build-push-action@v3 + with: + context: . + file: Dockerfile.Isar push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} diff --git a/Dockerfile.Isar b/Dockerfile.Isar new file mode 100644 index 0000000..b921f64 --- /dev/null +++ b/Dockerfile.Isar @@ -0,0 +1,10 @@ +FROM ghcr.io/equinor/isar:latest + +ARG ROBOT_REPOSITORY_CLONE_URL=https://github.com/equinor/isar-turtlebot.git + +RUN pip install git+${ROBOT_REPOSITORY_CLONE_URL}@main + +RUN useradd -ms /bin/bash --uid 1001 isar +RUN chown -R 1001 /app +RUN chmod 755 /app +USER 1001 diff --git a/Dockerfile b/Dockerfile.Simulator similarity index 100% rename from Dockerfile rename to Dockerfile.Simulator diff --git a/README.md b/README.md index ec78f46..cbbc238 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ docker-compose up --build The simulation world that is used can be set by changing the world variable in the 'entrypoint.sh' file. -Additional settings, such as using Nvidia GPU or gamepad input to the docker container is included via separate .yml-files. To run the docker container with these settings the corresponding `docker-compose-setting.yml` file must be spesified together with the main `docker-compose.yml` file. Several setting files can be included. +Additional settings, such as using Nvidia GPU or gamepad input to the docker container is included via separate .yml-files. To run the docker container with these settings the corresponding `docker-compose-setting.yml` file must be specified together with the main `docker-compose.yml` file. Several setting files can be included. ```bash docker-compose -f docker-compose.yml -f docker-compose-setting.yml up --build diff --git a/docker-compose.yml b/docker-compose.yml index f17f587..acf29b5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,7 +5,7 @@ services: container_name: turtle_sim build: context: ./ - dockerfile: Dockerfile + dockerfile: Dockerfile.Simulator ports: - "9090:9090" - "5000:5000"