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

Use image on dockerhub instead of a Dockerfile #1

Closed
vaind opened this issue Oct 12, 2019 · 5 comments
Closed

Use image on dockerhub instead of a Dockerfile #1

vaind opened this issue Oct 12, 2019 · 5 comments
Labels
enhancement New feature or request

Comments

@vaind
Copy link

vaind commented Oct 12, 2019

Is there any reason the action is set up to build an image each time? It takes 2-3 minutes on each run which could be avoided if the action has used a pre-built image.

from a pipeline:

Build axel-op/dart_package_analyzer@stable2m 47s
+ http 0.12.0+2
Build container for action use: '/home/runner/work/_actions/axel-op/dart_package_analyzer/stable/Dockerfile'.
/usr/bin/docker build -t e959fb:8ba3abdaf5da4bc49bdc5ac1a36bc06a "/home/runner/work/_actions/axel-op/dart_package_analyzer/stable"

If I'm not mistaken, this is the line that would need to be changed (besides pushing the image to dockerhub):
https://github.com/axel-op/dart_package_analyzer/blob/stable/action.yml#L21

What do you think?

@axel-op
Copy link
Owner

axel-op commented Oct 12, 2019

Hi,

Thanks for the suggestion! I'm pretty new to Docker, that's why I haven't thought about that.
However, creating an image would mean to freeze the Flutter version used, instead of always having the latest. Do you have an idea about how I could handle that?

Also, I looked into the comments of the PR you linked.

From objectbox/objectbox-dart#31 (comment):

This line basically: githubToken: ${{ secrets.GITHUB_TOKEN }}.
I cannot set that secret up and wanted to know if GITHUB_TOKEN is fine as a key or if a different key is better. Maybe PANA_GITHUB_TOKEN so you know that it's about package analysis?

@GregorySech You don't have to create this secret by yourself, it is already included by GitHub in the action's context (see https://help.github.com/en/articles/contexts-and-expression-syntax-for-github-actions#github-context). You just have to write it like it is in the README.

Also you don't have to run pub get by yourselves, as my action already does that for you.

Finally I noticed you run this action twice for two different packages, but in the same job. Maybe I could recommend you to do it in two separate jobs (that you can write in the same workflow file), as each job is run in parallel by GitHub (see https://help.github.com/en/articles/workflow-syntax-for-github-actions#jobs).

@vaind
Copy link
Author

vaind commented Oct 12, 2019

Hi,

Thanks for the suggestion! I'm pretty new to Docker, that's why I haven't thought about that.
However, creating an image would mean to freeze the Flutter version used, instead of always having the latest. Do you have an idea about how I could handle that?

Yes, the version would be fixed to the one you've pushed your image with, however you could even set up your CI (in this project) to update the periodically (e.g. every day) running the action on schedule.

Also, I looked into the comments of the PR you linked.

Thanks for that :)

From objectbox/objectbox-dart#31 (comment):

This line basically: githubToken: ${{ secrets.GITHUB_TOKEN }}.
I cannot set that secret up and wanted to know if GITHUB_TOKEN is fine as a key or if a different key is better. Maybe PANA_GITHUB_TOKEN so you know that it's about package analysis?

@GregorySech You don't have to create this secret by yourself, it is already included by GitHub in the action's context (see https://help.github.com/en/articles/contexts-and-expression-syntax-for-github-actions#github-context). You just have to write it like it is in the README.

Also you don't have to run pub get by yourselves, as my action already does that for you.

Finally I noticed you run this action twice for two different packages, but in the same job. Maybe I could recommend you to do it in two separate jobs (that you can write in the same workflow file), as each job is run in parallel by GitHub (see https://help.github.com/en/articles/workflow-syntax-for-github-actions#jobs).

Running the action twice in the same job = trying to avoid building the image twice, though yes, I didn't realize github runs it in parallel so it was actually faster as it originally was.

@GregorySech
Copy link

GregorySech commented Oct 12, 2019

Thanks, I'll remove the pub get and fix the key once I'll identify what differs from my local installation of pana.

edit: the key name already matches

@axel-op axel-op added the enhancement New feature or request label Oct 12, 2019
@axel-op
Copy link
Owner

axel-op commented Oct 12, 2019

I've made it! Build time has been reduced threefold.
I could still improve it however, I'll work on further improvements.

@axel-op
Copy link
Owner

axel-op commented Oct 12, 2019

Changes made!

@axel-op axel-op closed this as completed Oct 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants