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

[MISC] Add minimal Dockerfile #198

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

yuxiang-gao
Copy link

This pull request adds a minimal workable Dockerfile to run Genesis.

To run it, first build the docker:

docker build -t genesis .

Then run it using the following command:

xhost +

docker run --gpus all --rm -it -e DISPLAY=$DISPLAY -v /tmp/.X11-unix/:/tmp/.X11-unix genesis python examples/tutorials/hello_genesis.py

Signed-off-by: Yuxiang Gao <[email protected]>
@zhouxian
Copy link
Collaborator

Thank you! Could you add something to readme with explanations?

@yuxiang-gao
Copy link
Author

Thank you! Could you add something to readme with explanations?

Sure, happy to. I'll ping you once I'm finished.

@antoinebou12
Copy link

antoinebou12 commented Dec 22, 2024

Can you add a docker-compose

https://github.com/ETSTribology/Genesis/blob/main/Dockerfile

my version

services:
  genesis:
    build:
      context: .
      dockerfile: Dockerfile
    image: genesis:latest
    runtime: nvidia
    environment:
      - DISPLAY=${DISPLAY}
    volumes:
      - /tmp/.X11-unix:/tmp/.X11-unix
    command: python examples/tutorials/hello_genesis.py
    deploy:
      resources:
        reservations:
          devices:
            - capabilities: [gpu]

@yuxiang-gao
Copy link
Author

Can you add a docker-compose

https://github.com/ETSTribology/Genesis/blob/main/Dockerfile

my version

services:
  genesis:
    build:
      context: .
      dockerfile: Dockerfile
    image: genesis:latest
    runtime: nvidia
    environment:
      - DISPLAY=${DISPLAY}
    volumes:
      - /tmp/.X11-unix:/tmp/.X11-unix
    command: python examples/tutorials/hello_genesis.py
    deploy:
      resources:
        reservations:
          devices:
            - capabilities: [gpu]

Thanks! I have included this version of compose file to this pull request.

@yuxiang-gao
Copy link
Author

yuxiang-gao commented Dec 23, 2024

Hi @zhouxian , can you take a look? I have updated both the English and Chinese version of the READMEs. Also added a docker-compose.yml file and instructions thanks to @antoinebou12 .

Signed-off-by: Yuxiang Gao <[email protected]>
@antoinebou12
Copy link

antoinebou12 commented Dec 23, 2024

You could also make a action to auto deploy to dockerhub

name: Build and Push Docker Images

on:
  push:
    branches:
      - main
      - docker
  pull_request:
    branches:
      - main
      - docker

jobs:
  build-and-push-standard:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout repository
        uses: actions/checkout@v3

      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v3

      - name: Log in to DockerHub
        uses: docker/login-action@v2
        with:
          username: ${{ secrets.DOCKER_USERNAME }}
          password: ${{ secrets.DOCKER_PASSWORD }}

      - name: Cache Docker layers
        uses: actions/cache@v3
        with:
          path: /tmp/.buildx-cache
          key: docker-${{ runner.os }}-${{ hashFiles('Dockerfile', '**/*.cpp', '**/*.h') }}
          restore-keys: |
            docker-${{ runner.os }}-

      - name: Build and Push Standard Docker Image
        uses: docker/build-push-action@v5
        with:
          context: .
          file: Dockerfile
          push: true
          tags: ${{ secrets.DOCKER_USERNAME }}/Genesis:latest
          cache-from: type=local,src=/tmp/.buildx-cache
          cache-to: type=local,dest=/tmp/.buildx-cache,mode=max
          platforms: linux/amd64

      - name: Test Standard Docker Image
        run: |
          docker run --rm ${{ secrets.DOCKER_USERNAME }}/Genesis:latest --help

@zhouxian
Copy link
Collaborator

@Kashu7100 any idea how we proceed with this?

@ziyanx02 ziyanx02 changed the title Add minimal Dockerfile [MISC] Add minimal Dockerfile Dec 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants