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

Dockerfile for pipelines? #11

Open
phitoduck opened this issue May 26, 2021 · 5 comments
Open

Dockerfile for pipelines? #11

phitoduck opened this issue May 26, 2021 · 5 comments
Labels
accessibility easy access and use of pipeline features

Comments

@phitoduck
Copy link

Hi there,

Is there a Dockerfile with the pipelines command and PHP already installed? The use for this would be to allow users to run bitbucket pipelines through docker using your tool. Something like:

docker run -v "path/to/docker.sock:..." <pipelines-image-tag> [PIPELINES OPTIONS] <PIPELINES ARGS>

If not, have you given any thought to whether this is possible? My team is looking for a way to run BBP locally, and this tool looks promising. I might be able to contribute a Dockerfile like this if we end up going that way.

@ktomk
Copy link
Owner

ktomk commented May 26, 2021

Is there a Dockerfile with the pipelines command and PHP already installed?

No, or none that I know about.

have you given any thought to whether this is possible?

Yes, I did. The Dockerfile itself is less the problem, pipelines need to be aware that it is dockerized.

This is merely meta. Pipelines can already be run within Docker, that is the "PIP - Pipelines Inside Pipelines" feature.

It then works very similar as you have outlined.

However you would need to have Docker as a dependency. And that you already have. And then pipelines only needs some PHP version with little requirements. So it should be more straight forward to just install that (take any PHP 5.3.3 - PHP 8.1*) and execute the pipelines.phar file.

Which operating system are you using?

@ktomk
Copy link
Owner

ktomk commented May 26, 2021

@phitoduck I quickly wrapped one docker image up, so there is something to play:

$ docker run --rm ktomk/pipelines:pipelines                          
pipelines version 0.0.57+5-g712771b+dirty

The default working directory is /app you can use to mount stuff in:

$ docker run --rm -it --entrypoint /bin/pwd ktomk/pipelines:pipelines
/app

to hint pipelines inside pipelines (here docker) the path to the original project directory, there is the PIPELINES_PROJECT_PATH (see README.md for a bit more description) - it is used so that pipelines can - when it detects it runs inside docker (might need more ENV parameters) to mount from host in case the --deploy mount option is in use (but the current container has copy).

sorry for the rough description, merely the quick hint that there are some environment variables if set, it could already run with this image.

I'll add lib/container/pipelines.sh later and link it here, it is the build script for the container.

ktomk added a commit that referenced this issue May 26, 2021
experimental pipelines container build script to run pipelines as a
docker image #11

#11: #11
ktomk added a commit that referenced this issue May 26, 2021
experimental pipelines container build script to run pipelines as a
docker image #11

#11: #11
@ktomk
Copy link
Owner

ktomk commented May 26, 2021

@phitoduck please find an experimental branch docker-pipelines to kick around with. feel free for any kind of feedback and questions. I'll think a bit about what is needed so that pipelines becomes aware running inside a container without a pipeline is already active.

there will be a couple of rough edges, feel free to name anything you run over.

@ktomk ktomk added the accessibility easy access and use of pipeline features label May 26, 2021
@ktomk
Copy link
Owner

ktomk commented Jun 1, 2021

@phitoduck if you'd like to contribute a Dockerfile for this I'm open to it. For the moment I'd keep this on a temporary branch and will rebase it occasionally.

ktomk added a commit that referenced this issue Nov 7, 2021
experimental pipelines container build script to run pipelines as a
docker image #11

#11: #11
ktomk added a commit that referenced this issue Dec 7, 2021
experimental pipelines container build script to run pipelines as a
docker image #11

#11: #11
@phitoduck
Copy link
Author

Wow, sorry for totally dropping off. Thanks for looking into this. It may be another while before I can look at this, but I think my team at work would really like this since it would make it easier to reproduce our exact pipeline locally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accessibility easy access and use of pipeline features
Projects
None yet
Development

No branches or pull requests

2 participants