Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,298,063
Community Members
 
Community Events
165
Community Groups

Running within a Docker container

Hi all,

I've created a docker image with the Windows runner:

https://hub.docker.com/repository/docker/symtech/bitbucket-pipelines-runner

https://bitbucket.org/symtechnz/bitbucket-pipelines-runner-docker

This makes it easier to start a build farm, and makes it easier to reproduce the build environment. Ideally I would have liked to use NanoServer for a minimal image, but I found it difficult to install Git from command line so I used Chocolatey which is based on WindowsServerCore. I stuck with Chocolatey because it makes it convenient to install more SDKs onto the image.

I'd love it if this could be offered directly by Atlassian.

 

 

3 comments

Kudos! This might just be what I need for my builds. I will have a look at it more closely later.

It seems to work but a few remarks:

  • It does download a fixed version worker, not latest version. I think you can do this easily by dropping the version number from the URL
  • Your image can be leaner by installing choco-cleaner and concatenate it to the install line of the chocolately packages using `; choco-clean`, e.g.:
    `
    RUN choco install -y \
    git.install \
    openjdk \
    ; choco-cleaner

I took the liberty of using your start.ps1 powershells script and incorporate it into a .NET Framework 4.6.1 microsoft based image using Dockerfile with below content:

FROM mcr.microsoft.com/dotnet/framework/sdk:4.8

# Install Chocolatey
ADD install-choco.ps1 install-choco.ps1
RUN powershell c:\install-choco.ps1

# Install git and openjdk and choco-cleaner to minimize docker container layer(s)
RUN choco install -y \
choco-cleaner \
; choco-cleaner

RUN choco install -y \
git.install \
openjdk \
; choco-cleaner

ADD https://product-downloads.atlassian.com/software/bitbucket/pipelines/atlassian-bitbucket-pipelines-runner.zip bitbucket-pipelines-runner.zip
RUN powershell -Command Expand-Archive bitbucket-pipelines-runner.zip C:\bitbucket-pipelines-runner

#WORKDIR C:\bitbucket-pipelines-runner\bin
WORKDIR C:/bitbucket-pipelines-runner/bin

# Install start script modified to inculde environment variabeles
ADD start.ps1 start.ps1

RUN git config --system core.longpaths true

ENTRYPOINT ["powershell", "./start.ps1"]

Like Ocky Saktya likes this

Newbie here, is there any example on how to use this runner in Bitbucket Pipeline?

Comment

Log in or Sign up to comment
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you