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

some information about installing megalinter in custom Dockerfile #3455

Closed
magowiz opened this issue Mar 29, 2024 · 4 comments
Closed

some information about installing megalinter in custom Dockerfile #3455

magowiz opened this issue Mar 29, 2024 · 4 comments
Labels
O: stale 🤖 This issue or pull request is stale, it will be closed if there is no activity question Further information is requested

Comments

@magowiz
Copy link

magowiz commented Mar 29, 2024

Hi,
I would like to build my own docker image with mega-linter inside, the main reason for this is that I use have mainly python projects and installing dependencies before scanning it takes longer on alpine based images, so I wanted to create a debian-based mega-linter flavor python.

I saw your repository docker files and they are complex, I would like to know if there is an installable package for at least megalinter program, without linters (I can install them separately and only those I want), if something like pip install megalinter or apt-get install megalinter or again npm i megalinter can be performed.

I saw the mega-linter-runner package but this, for what I understand, creates configuration locally and download standard images.

Please let me know.
Best regards,

magowiz

@magowiz magowiz added the question Further information is requested label Mar 29, 2024
@nvuillam
Copy link
Member

Hi @magowiz the "MegaLinter program" kind of is the MegaLinter image, it's not possible to run without it :/

All MegaLinter descriptors contain the installation instructions to build the Dockerfile, and those instructions are specific to alpinelinux (examples: use of apk , reuse of alpine based docker images of linters ... )

So unfortunately I don't see a way to create debian-based ML image without major updates in MegaLinter:

  • Add debian related install instructions in all descriptors
  • Update CI to build alpine images + debian images

With the 100+ linters, such task seems huge :/

@echoix
Copy link
Collaborator

echoix commented Mar 31, 2024

I think he was referring to the python logic, that we install in each image. If it were an installable Python package, he would be able to do his images

@nvuillam
Copy link
Member

Oh I see

MegaLinter is not published on a package manager, but its "core" code is corresponding to the following lines

So you might do something like getting source files on MegaLinter repo then run the lines in your debian image to have MegaLinter python core + descriptors + default config in it

COPY megalinter /megalinter
RUN PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py install \
    && PYTHONDONTWRITEBYTECODE=1 python /megalinter/setup.py clean --all \
    && rm -rf /var/cache/apk/* \
    && find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf

#######################################
# Copy scripts and rules to container #
#######################################
COPY megalinter/descriptors /megalinter-descriptors
COPY TEMPLATES /action/lib/.automation

Copy link
Contributor

github-actions bot commented May 1, 2024

This issue has been automatically marked as stale because it has not had recent activity.
It will be closed in 14 days if no further activity occurs.
Thank you for your contributions.

If you think this issue should stay open, please remove the O: stale 🤖 label or comment on the issue.

@github-actions github-actions bot added the O: stale 🤖 This issue or pull request is stale, it will be closed if there is no activity label May 1, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
O: stale 🤖 This issue or pull request is stale, it will be closed if there is no activity question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants