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

publish official docker image #100

Open
exfly opened this issue Jan 24, 2020 · 18 comments
Open

publish official docker image #100

exfly opened this issue Jan 24, 2020 · 18 comments
Assignees
Labels
Docker Docker image issues enhancement New feature or request pipeline Related to the build pipeline

Comments

@exfly
Copy link

exfly commented Jan 24, 2020

No description provided.

@guyacosta
Copy link
Contributor

Great idea. Will look into which API's would be affected and let you know.

@guyacosta guyacosta added the enhancement New feature or request label Jan 25, 2020
@jusso-dev
Copy link

jusso-dev commented Jan 28, 2020

The biggest initial issue you are going to have with this is how to consume the output, because it writes either the JSON or HTML output relative to where the program has run. Ie. in this case, inside the container.

You would either need to write a REST API layer to expose the results over HTTP
OR
Write another positional argument layer to write the output to some form of online reachable storage bucket, either Azure Blob Storage or an S3 bucket.

*EDIT - there's one more option, the Docker image mandates the use of volumes so the output can be consumed remotely

@eoftedal
Copy link

eoftedal commented Feb 8, 2020

Yeah, the last option is the one I would prefer.
Mount the current folder as a volume, and scan that and push the report into the same folder.

@eoftedal
Copy link

eoftedal commented Feb 8, 2020

Dockerfile:

FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster

RUN apt-get update && apt install unzip

WORKDIR /app

ENV VERSION=1.0.26

RUN curl -L https://github.com/microsoft/ApplicationInspector/releases/download/v${VERSION}/ApplicationInspector_linux_${VERSION}.zip -o /app/appinspect.zip && \
    unzip appinspect.zip && \
    mv /app/ApplicationInspector_${VERSION}/ /app/ApplicationInspector

ENTRYPOINT ["dotnet", "/app/ApplicationInspector/AppInspector.dll"]

Build image:
docker build -t appinspect .
Run scan (from folder you want to scan):
docker run -v $(pwd):/data appinspect analyze -s /data

@jusso-dev
Copy link

jusso-dev commented Feb 11, 2020

EDIT** Have to use buster as there is not "apt-get" in alpine, and have changed the useradd command. Also, remove dependencies that are not needed after build.

I like the above, but I think this is better from a security stand-point

FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster

RUN apt-get update && apt install unzip

WORKDIR /app

ENV VERSION=1.0.26

RUN curl -L https://github.com/microsoft/ApplicationInspector/releases/download/v${VERSION}/ApplicationInspector_linux_${VERSION}.zip -o /app/appinspect.zip && \
    unzip appinspect.zip && \
    mv /app/ApplicationInspector_${VERSION}/ /app/ApplicationInspector

RUN rm appinspect.zip 
RUN apt-get remove unzip -y

RUN useradd --create-home --shell /bin/bash appinspector
USER appinspector

ENTRYPOINT ["dotnet", "/app/ApplicationInspector/AppInspector.dll"]

@jusso-dev
Copy link

So this is actually blocked by issue #133 due to the following error:

"Analyze command running
100% source files processed
Preparing report
A runtime error has occured. Please see log file for more information."

You cannot open a browser in Docker.

Att: @guyacosta

@guyacosta
Copy link
Contributor

#133 is fixed with commit #145. I have a non-public Azure Function that exposes the AppInspector analyze functionality. I like the option to submit an online storage source and target with an auth token etc. I'm getting some tasks out of the way to focus on more enhancements like full Docker support but believe this option is low hanging as there is less ramp etc. I'll see what I can do this week for it.

@guyacosta
Copy link
Contributor

We've discussed this last option and decided to let this get handled by user developers to mount a source and destination drive. We still plan to provide Docker support which is coming soon.

@gfs
Copy link
Contributor

gfs commented Mar 7, 2020

@jusso-dev

Try this:

FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster

RUN dotnet tool install --global Microsoft.CST.ApplicationInspector.CLI

ENTRYPOINT ["appinspector"]

@jusso-dev
Copy link

That’ll work @gfs, once I have a Dockerfile that works, do you want me to submit a pull request, along with instructions on how to use it?

@gfs
Copy link
Contributor

gfs commented Mar 7, 2020

We are working on a dockerfile that can be used in our pipeline to push an image to docker hub. That will need to not take a dependency on the dotnet tool installer since it will be built in the devops pipeline.

Once we have that up and running you should be able to pull an image directly from docker hub.

@SamBalg
Copy link

SamBalg commented Mar 23, 2020

@gfs We are also working on similar requirement. Is your docker image ready ?

@gfs
Copy link
Contributor

gfs commented Mar 23, 2020

@daalcant is working on the pipeline components.

In the meantime you can use the short dockerfile I posted above.

@SamBalg
Copy link

SamBalg commented Mar 23, 2020

Trying to spin up a docker containers with a docker-compose file , which spins up Redis and AppInspector, is there a way I can directly call AppInspector Image in the compose file ? Also where will it store the scan results?

@gfs
Copy link
Contributor

gfs commented Mar 23, 2020 via email

@gfs
Copy link
Contributor

gfs commented Mar 23, 2020

You can also check the official documentation here: https://docs.docker.com/compose/gettingstarted/#step-3-define-services-in-a-compose-file

For an example of using docker compose with building a Dockerfile.

@gfs gfs changed the title Can it be run in docker? publish official docker image May 24, 2020
@gfs gfs added Docker Docker image issues pipeline Related to the build pipeline labels May 24, 2020
@james-garriss
Copy link

Would like to see this issue revisited. It would be helpful to release a Dockerfile using current containers and/or an image on Docker Hub. It would also be helpful to have a GitHub Action so that it can be used as part of CI/CD pipelines on GitHub.

@gfs
Copy link
Contributor

gfs commented Nov 15, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Docker Docker image issues enhancement New feature or request pipeline Related to the build pipeline
Projects
None yet
Development

No branches or pull requests

8 participants