1

Consider this GA workflow:

name: My GA Workflow

on: push

jobs:
  myJobName:
    runs-on: ubuntu-latest
    container: cypress/included:10.6.0
    steps:
      - name: Ensure tools are available
        shell: bash
        run: |
          apt-get update && \
          apt-get install -y unzip zstd netcat

    # and so on...

I would like to have a crystal clear understanding what happens there. Currently I reckon:

  1. GA will run a ubuntu-latest virtual machine with docker engine pre-installed.
  2. It will pull and run cypress/included:10.6.0.
  3. All the steps will run inside the Cypress docker container, not on the Ubuntu machine.

Is that correct?

1

3 Answers 3

2

Yes your understanding is correct. The full documentation is here https://docs.github.com/en/actions/using-jobs/running-jobs-in-a-container

0
  1. We should have docker images in the dockerhub. if we require customized docker image we can create docker image using the docker file

  2. We can create application.yml files by using github actions workflow.

  3. Application.yaml file for docker containers looks like this:

name: container # Workflow-name

on: push #when a push is made to branch in the workflow's repository

jobs: # Actionsto be performed after push happened

node-docker:

runs-on: ubuntu-latest# Running OS on which actions will be performed 

container: 

  image: node:14.15.0-alpine3.12 # docker-image-tag, it will pull from Dockerhub and container get created 
-1

Creating a Dockerfile In your new hello-world-docker-action directory, create a new Dockerfile file. Make sure that your filename is capitalized correctly (use a capital D but not a capital f) if you're having issues. For more information, see "Dockerfile support for GitHub Actions."

Dockerfile

# Container image that runs your code
FROM alpine:3.10

# Copies your code file from your action repository to the filesystem path `/` of the container
COPY entrypoint.sh /entrypoint.sh

# Code file to execute when the docker container starts up (`entrypoint.sh`)
ENTRYPOINT ["/entrypoint.sh"]

Creating an action metadata file Create a new action.yml file in the hello-world-docker-action directory you created above. For more information, see "Metadata syntax for GitHub Actions."

action.yml

YAML
# action.yml
name: 'Hello World'
description: 'Greet someone and record the time'
inputs:
  who-to-greet:  # id of input
    description: 'Who to greet'
    required: true
    default: 'World'
outputs:
  time: # id of output
    description: 'The time we greeted you'
runs:
  using: 'docker'
  image: 'Dockerfile'
  args:
    - ${{ inputs.who-to-greet }}

This metadata defines one who-to-greet input and one time output parameter. To pass inputs to the Docker container, you should declare the input using inputs and pass the input in the args keyword. Everything you include in args is passed to the container, but for better discoverability for users of your action, we recommended using inputs.

GitHub will build an image from your Dockerfile, and run commands in a new container using this image.

2
  • This appears like an answer generated by some poorly trained AI model. The question was "Is that correct?". So, is it?
    – Greendrake
    Commented Sep 11, 2022 at 12:32
  • Or rather a copy from the Github manual.
    – Kamiccolo
    Commented May 17, 2023 at 16:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.