Skip to content

SoftwareCraftsman/docker-atlassian-bitbucket-base

Repository files navigation

README

Docker Image atlassian-bitbucket-base image layers atlassian-bitbucket-base image layers

This image provides a Bitbucket Server with an embedded database which is sufficient for demo and evaluation purpose. However, for production it is advised to use one of the supported external databases (e.g. PostgreSQL).

The following instructions show how to build and run Bitbucket Server.

Prepare a docker host

docker-machine create --driver virtualbox atlassian (1)
docker-machine start atlassian (2)
eval `docker-machine env atlassian` (3)
  1. Create a docker machine (once only)

  2. Start the docker machine

  3. Setup the docker client to use the docker-machine

Build the image

Build with VCS information built-in as docker label
docker build --build-arg vcs_ref=$(git rev-parse --short HEAD) -t softwarecraftsmen/atlassian-bitbucket-base .

Building on Docker Hub

hooks/build is a script that performs a custom build providing build metadata for Docker image labels according to http://label-schema.org/.

Publish to Docker Hub

Tag the git repository using the bitbucket version number as tag

git tag <bitbucket-version>
git push origin master --tags

Run a Bitbucket Server instance

The Bitbucket container uses tini as init system. The tini executable is expected at /dev/tini. As of Docker 1.13 tini is included in Docker itself. But it is not enabled by default, see https://docs.docker.com/engine/reference/commandline/dockerd.

dockerd configuration
{
  "init" : true
}

Further each container instance must be created using the --init option.

docker pull softwarecraftsmen/atlassian-bitbucket-base
docker run -d --init --name bitbucket-server -p 7990:7990 softwarecraftsmen/atlassian-bitbucket-base

To open Bitbucket Server start page on Mac OSX run `open http://$(docker-machine ip atlassian):7990`from the shell:

Customizing Bitbucket

Environment Variables

During the first start of the container a few environment variables are considered for providing default values for the setup wizard. These allow for a fully automated setup without setup wizard intervention.

The subset of supported properties is as follows.

Table 1. bitbucket.properties variables
Environment `bitbucket.properties Default

BITBUCKET_LICENSE

setup.license

BITBUCKET_SYSADMIN_USERNAME

setup.sysadmin.username

Required for fully setting up an administrator account

BITBUCKET_SYSADMIN_PASSWORD

setup.sysadmin.password

Required for fully setting up an administrator account

BITBUCKET_SYSADMIN_DISPLAYNAME

setup.sysadmin.displayName

Required for fully setting up an administrator account

BITBUCKET_SYSADMIN_EMAIL

setup.sysadmin.emailAddress

Required for fully setting up an administrator account

BITBUCKET_JDBC_USER

jdbc.user

Required for setting up an external database

BITBUCKET_JDBC_PASSWORD

jdbc.password

Required for setting up an external database

BITBUCKET_JDBC_DRIVER

jdbc.driver

Required for setting up an external database

BITBUCKET_JDBC_URL

jdbc.url

Required for setting up an external database

BITBUCKET_DISPLAYNAME

setup.displayName

BITBUCKET_BASEURL

setup.baseUrl

Table 2. Reverse proxy variables
Variable Default value Comment

SERVER_PROXY_NAME

-

-

SERVER_PROXY_PORT

-

-

SERVER_SCHEME

http

-

SERVER_SECURE

false

-

HTTP/HTTPS proxy variables

The container will respect the http_proxy https_proxy and no_proxy variables and expose those as variable JVM_SUPPORT_RECOMMENDED_ARGS according to https://docs.oracle.com/javase/8/docs/technotes/guides/net/proxies.html.

External database

For replacing the internal embedded database we just have to set 2 environment variables for the JDBC driver and URL. Below is an example for PostgreSQL.

Connecting to PostgreSQL
export BITBUCKET_JDBC_DRIVER=org.postgresql.Driver
export BITBUCKET_JDBC_URL=jdbc:postgresql://postgresdb:5432/bitbucket

Custom bitbucket.properties

For adding more custom properties we just can add a ${BITBUCKET_HOME}/bitbucket.properties file to the image. It will be moved to $BITBUCKET_HOME/shared/bitbucket.properties during the initial startup.

The extending image can add this file in its Dockerfile like

COPY bitbucket.properties ${BITBUCKET_HOME}/shared/bitbucket.properties

This base image offers a few environment variables especially for setting sensitive settings such as password or license keys that should not be committed to the repository. They are automatically written into their respective property keys in bitbucket.properties. These are better set through environment variables and passed to the container rather than hard coded into bitbucket.properties.

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published