slimtoolkit / slim

Slim(toolkit): Don't change anything in your container image and minify it by up to 30x (and for compiled languages even more) making it secure too! (free and open source)
Apache License 2.0
18.89k stars 704 forks source link

slim ci-cd-integration #583

Open TomiwaAribisala-git opened 9 months ago

TomiwaAribisala-git commented 9 months ago

Integrating Slim across CI/CD environments is showcased in the repo, however, there should be demonstrated examples across CI/CD environments.

TomiwaAribisala-git commented 9 months ago

Hello @kcq, about demonstrated examples of using Slim across CI/CD environments, I have uploaded a use case for Jenkins and Github Actions here--https://github.com/TomiwaAribisala-git/slim-ci-cd-integration, I look forward to your favorable response, thanks.

ybalcanci commented 6 months ago

Hello, I am trying to integrate slim into my Jenkins pipeline for my nodejs backend image as well. However, slim is trying to run the container on build command and my image doesn't run because it cannot connect to any database in pipeline. What do you suggest for this? Should I create database specificly for it to connect to during Jenkins pipeline?

Some details: I am not running a SaaS application or anything. I ship my database as another docker image so that the output image of my Jenkins nodejs pipeline and the database image can be run together using docker compose. It's not even only the 2 of them. I have several repositories and several Jenkins jobs to create images that will result in an application. And the containers have socket connections and api calls to each other etc. I know that docker compose file can be passed to slim but in a specific Jenkins job, it doesn't have access to all images so it can't run docker compose up [-d] successfully either. Should I make every image available to Jenkins so that it can successfully analyze them in pipeline or should I avoid trying to use slim in Jenkins for such a complicated case?

kcq commented 6 months ago

Hello, I am trying to integrate slim into my Jenkins pipeline for my nodejs backend image as well. However, slim is trying to run the container on build command and my image doesn't run because it cannot connect to any database in pipeline. What do you suggest for this? Should I create database specificly for it to connect to during Jenkins pipeline?

Some details: I am not running a SaaS application or anything. I ship my database as another docker image so that the output image of my Jenkins nodejs pipeline and the database image can be run together using docker compose. It's not even only the 2 of them. I have several repositories and several Jenkins jobs to create images that will result in an application. And the containers have socket connections and api calls to each other etc. I know that docker compose file can be passed to slim but in a specific Jenkins job, it doesn't have access to all images so it can't run docker compose up [-d] successfully either. Should I make every image available to Jenkins so that it can successfully analyze them in pipeline or should I avoid trying to use slim in Jenkins for such a complicated case?

@ybalcanci If the database is the only "must have" dependency for your image than one of the options is to reference an existing database running somewhere using an environment variable (assuming your image supports passing the database connection string through an environment variable). For example, in some of my tests I have a SaaS hosted database and then I add an --env flag to the slim build command to pass the database connection string for it. If your image has other external container dependencies too (beyond just that database dependency) than you can try to use the same env var approach or you can try using the compose functionality in slim (yes, if you go this direction you'll need to make sure the images referenced in the compose file are accessible in your Jenkins job)

ybalcanci commented 6 months ago

@kcq I see, thanks for the clarification.