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

Build a docker image with greenframe-cli #19

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

Conversation

vpeltot
Copy link
Contributor

@vpeltot vpeltot commented Nov 14, 2022

Closes #18

Copy link
Member

@fzaninotto fzaninotto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

Dockerfile Outdated


## Specific build with GCP tools
FROM base as gcp
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is this part related to greenframe?

Copy link
Contributor Author

@vpeltot vpeltot Nov 14, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gcloud command line tools are required to use kubectl ... commands in the Google Cloud Platform kubernetes execution context, especially for all authentication steps.
It's the same for Azure and AWS.

I think it would be great to offer all the necessary tools for the major cloud providers (GCP, AWS, Azure) and create a specific version of the greenframe-cli image.

I added a new make command (which can be used in the GitHub workflow) to build these images:

DOCKER_BUILDKIT=1 docker build -t greenframe-cli:latest -t greenframe-cli:$(PACKAGE_VERSION) . --target base

for the base image, and:

DOCKER_BUILDKIT=1 docker build -t greenframe-cli:$(PACKAGE_VERSION)-gcp . --target gcp 
etc ...

for the specific cloud providers.

One greenframe-cli version will have these docker version:

  • greenframe-cli:latest
  • greenframe-cli:1.4.4
  • greenframe-cli:1.4.4-gcp
  • greenframe-cli:1.4.4-azure
  • greenframe-cli:1.4.4-...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not something we want to maintain in this repository. I prefer that we provide a cloud-agnostic base image, and leave to the community the cloud-specific images.

@fzaninotto fzaninotto changed the title marmelab/greenframe-cli:#18 Build a docker image with greenframe-cli Build a docker image with greenframe-cli Nov 14, 2022
@fzaninotto
Copy link
Member

Awesome! Your PR is in Draft, what's left to finish it?

@vpeltot
Copy link
Contributor Author

vpeltot commented Nov 17, 2022

I just pushed a new commit with

  • Update README file to add a "docker" section
  • Change the greenframe-cli image name to just greenframe to be consistent with the command line. I think it's better to have $ docker run marmelab/greenframe analyze ... istead of $ docker run marmelab/greenframe-cli analyze ...
  • Add an entrypoint & default --version command

@vpeltot vpeltot marked this pull request as ready for review November 17, 2022 08:07
@vpeltot
Copy link
Contributor Author

vpeltot commented Nov 17, 2022

@fzaninotto
Can you set the environment variables DOCKER_REGISTRY_USER and DOCKER_REGISTRY_PASS values with your docker hub credentials?

Dockerfile Outdated Show resolved Hide resolved
@vpeltot vpeltot requested a review from fzaninotto November 30, 2022 07:27
@floo51
Copy link
Contributor

floo51 commented Dec 7, 2022

Hello Vincent,

I've checked out locally and tried to run a greenframe analyze using the provided Dockerfile:

# from project root
docker build -t greenframe-docker-in-docker-test .
docker run -v $(pwd)/:/app greenframe-docker-in-docker-test analyze -C ./.greenframe.e2e.yml

I'm getting an error about being unable to connect to the Docker daemon:

❌ main scenario failed
This scenario fail during the execution:
Command failed: docker create --tty --name greenframe-runner --rm -e HOSTIP=172.17.0.3 --add-host localhost:172.17.0.3  mcr.microsoft.com/playwright:v1.28.1-focal
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

I thought this was dind based but now realize it might be dood (Docker outside of Docker), do we have to map the docker sock from host to container for it to work?

If yes, we need to document it, and we could use an alpine based image so that the final image is lighter, I worked on a dood alpine image so it might come handy.

@npotier
Copy link

npotier commented Jan 4, 2023

Hello. First of all I would like to thank you for this project.

Juste my 2 cents here. We have created a small and simple Docker image in order to run greenframe-cli : https://github.com/acseo/docker-greenframe-cli

You cans use it to test a remote or a local website :

$ docker run -it -v /var/run/docker.sock:/var/run/docker.sock acseo/greenframe-cli \ 
    greenframe analyze https://www.acseo.fr
$ docker run -it \
    -e "DEBUG=*" \
    --network="host" \
    -v $(pwd)/greeframe.yml:/app/greenframe.yml \
    -v $(pwd)/scenario.js:/app/scenario.js \
    -v /var/run/docker.sock:/var/run/docker.sock \
    acseo/greenframe-cli greenframe analyze -C /app/greenframe.yml http://my-app.local /app/greenframe.js

Maybe it will be useful for someone 😃

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.

Dockerize greenframe-cli
5 participants