#is there any dagger method to install

1 messages · Page 1 of 1 (latest)

misty shore
worthy jay
#

what if we use graphql natively and dont use any sdk for this and want to achieve this?

sharp tiger
sharp tiger
#

but you can use GraphQL from any language potentially. What is your use case?

worthy jay
#

we are not able to run dagger for both archi amd and arm from one docker image, that's it

#

@sharp tiger please help when you will be free

sharp tiger
misty shore
worthy jay
#

And this is docker file on which we want to run dagger with multi archite in automode

#
FROM docker:dind

# dagger image
FROM ghcr.io/dagger/engine:main

# Mount Docker socket
VOLUME /var/run/docker.sock

# Set the working directory
WORKDIR /app

# Copy the application files
COPY . /app

# Set the shell
SHELL ["/bin/bash", "-c"]

# Set the entrypoint
ENTRYPOINT ["/bin/bash", "-c"]

LABEL org.opencontainers.image.source https://github.com/StaytunedLLP/github-automation
misty shore
# worthy jay ``` FROM docker:dind # dagger image FROM ghcr.io/dagger/engine:main # Mount Do...

Ah I understand. I think what you're looking for is docker buildx build instead of docker build when you're building that dockerfile. https://docs.docker.com/engine/reference/commandline/buildx_build/#platform

Docker Documentation

docker buildx build: The buildx build command starts a build using BuildKit. This command is similar to the UI of docker build command and takes the same flags and arguments....

worthy jay
#

can you reply me back updated docker file which will work? i wil be so thankful if you can do this

misty shore
#

The dockerfile is ok, it's how you build the dockerfile that needs to be changed to create a multiplatform image. The docs I linked for buildx should help

worthy jay
#
name: docker | dagger-in-docker-amd

on: workflow_dispatch

jobs:
  create-image:
    runs-on: [self-hosted, pi4b-01]
    env:
      PACKAGE_NAME: dagger-in-docker-amd
      GITHUB_TOKEN: ${{ secrets.DOCKER_PASSWORD }}

    steps:
      - uses: docker/buildx-action@v2

      - name: Creating & pushing container image
        env:
          DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
        run: |
          echo $GITHUB_TOKEN | docker login ghcr.io -u $DOCKER_USERNAME --password-stdin
          docker buildx build --platform linux/amd64,linux/arm64 --push -t ghcr.io/staytunedllp/$PACKAGE_NAME -f dockerfiles/$PACKAGE_NAME.dockerfile .
          echo "Image Pushed"
          
      # - name: Pushing container image
      #   run: |
      #     docker push ghcr.io/staytunedllp/$PACKAGE_NAME:latest
      #     echo "Pushed Image"

      - name: Getting  Detail
        run: |
          OWNER=$(echo ${{ github.repository }} | cut -d/ -f1)
          echo "github_owner=$OWNER" >> $GITHUB_ENV

      - name: Deleting older versions of container image
        env:
          EVENT_TYPE: "delete-old-package-version"
          CLIENT_PAYLOAD: '{"package_name": "${{env.PACKAGE_NAME}}","owner": "${{env.github_owner}}"}'
        run: |
          chmod +x $(pwd)/scripts/build-token.sh
          docker run \
          -v $(pwd):/app -v /var/run/docker.sock:/var/run/docker.sock \
          -e GITHUB_TOKEN="${{env.GITHUB_TOKEN}}" \
          -e EVENT_TYPE="${{env.EVENT_TYPE}}" \
          -e CLIENT_PAYLOAD='${{env.CLIENT_PAYLOAD}}' \
          --rm ghcr.io/staytunedllp/dagger-in-docker-amd:latest \
          "dagger run ./scripts/build-token.sh"

is this file ok?

misty shore
#

Yeah looks ok at a glance! I'm curious, what's your use case for running dagger-in-docker rather than directly on the github runner?

worthy jay
#

we dont want to make dependency of installing docker and dagger cli all the time if we change machine for github self hosted runner and we have achieved it, but now facing arm/amd issues if we want to run on github runners, currently its working if we runs on github selfhosted runner on ubuntu pi4b but it's not working in github runner

#

@misty shore can you help to solve this?

misty shore
#

I guess its a bit unique since you're using graphql instead of an sdk so you depend on the dagger cli and that isn't a prerequisite if you're using an sdk. An alternative would be to install the cli in the github workflow instead of prebuilding an image

worthy jay
#

but it's taking time which is not advisable sometime for instant automations

misty shore
#

is it that much more time than pulling the image?

worthy jay
#

yes self hosted runner can have images from local

misty shore
#

makes sense

worthy jay
#

now please help bro

misty shore
#

does the buildx not solve the problem? it will create an image that can be run on either amd64 or arm64

worthy jay
#

not working in github action to build images for buildx

#

hey i would like to know if i will use rust sdk then how it will work without cli and i need to compile rust right to execute dagger run?

misty shore
worthy jay
#

can you share any guide for this with rust?

#

this command will compile rust first and then execute dagger run right, which may take time based on rust code

dagger run cargo run
misty shore
#

yes, but you can also just cargo run. Right now, the dagger cli just provides an improved TUI for your local experience

worthy jay
#

yes but rust code will take time right to compile?

misty shore
#

it's non-zero, but in general pipeline code is pretty quick to compile