Dockerfile

FROM openjdk:8-bullseye

LABEL maintainer="waringid <waringid@gmail.com>" version="7.21.16"

ARG BITBUCKET_VERSION=7.21.16
ARG BITBUCKET_PRODUCT=bitbucket-software
ARG AGENT_VERSION=1.3.3
ARG MYSQL_DRIVER_VERSION=8.0.22

RUN apt-get update \
    && apt-get upgrade -y \
    && apt-get install -y --no-install-recommends git fontconfig openssh-client perl python3 python3-jinja2 tini \
    && apt-get clean autoclean && apt-get autoremove -y && rm -rf /var/lib/apt/lists/* 

ENV BITBUCKET_USER=bitbucket \
    BITBUCKET_GROUP=bitbucket \
    BITBUCKET_HOME=/var/bitbucket \
    BITBUCKET_INSTALL=/opt/bitbucket \
    JVM_MINIMUM_MEMORY=2g \
    JVM_MAXIMUM_MEMORY=6g \
    JVM_CODE_CACHE_ARGS='-XX:InitialCodeCacheSize=2g -XX:ReservedCodeCacheSize=6g' \
    AGENT_PATH=/var/agent \
    AGENT_FILENAME=atlassian-agent.jar

ENV JAVA_OPTS="-javaagent:${AGENT_PATH}/${AGENT_FILENAME} ${JAVA_OPTS}"

RUN mkdir -p ${BITBUCKET_INSTALL} ${BITBUCKET_HOME} ${AGENT_PATH} \
&& curl -o ${AGENT_PATH}/${AGENT_FILENAME}  https://github.com/haxqer/jira/releases/download/v${AGENT_VERSION}/atlassian-agent.jar -L \
&& curl -o /tmp/atlassian.tar.gz https://product-downloads.atlassian.com/software/stash/downloads/atlassian-bitbucket-${BITBUCKET_VERSION}.tar.gz -L \
&& tar xzf /tmp/atlassian.tar.gz -C ${BITBUCKET_INSTALL}/ --strip-components 1 \
&& rm -f /tmp/atlassian.tar.gz \
&& curl -o ${BITBUCKET_INSTALL}/app/WEB-INF/lib/mysql-connector-java-${MYSQL_DRIVER_VERSION}.jar https://repo1.maven.org/maven2/mysql/mysql-connector-java/${MYSQL_DRIVER_VERSION}/mysql-connector-java-${MYSQL_DRIVER_VERSION}.jar -L

RUN export CONTAINER_USER=$BITBUCKET_USER \
&& export CONTAINER_GROUP=$BITBUCKET_GROUP \
&& groupadd -r $BITBUCKET_GROUP && useradd -r -g $BITBUCKET_GROUP $BITBUCKET_USER \
&& chown -R $BITBUCKET_USER:$BITBUCKET_GROUP ${BITBUCKET_INSTALL} ${BITBUCKET_HOME}/ ${AGENT_PATH}

VOLUME $BITBUCKET_HOME
USER $BITBUCKET_USER
WORKDIR $BITBUCKET_INSTALL
EXPOSE 7990
EXPOSE 7999

ENTRYPOINT ["/opt/bitbucket/bin/start-bitbucket.sh", "-fg"]

docker-compose

version: '3.4'
services:
  bitbucket:
    image: haxqer/bitbucket:7.21.16
    container_name: bitbucket-srv
    environment:
      - TZ=Asia/Shanghai
#      - JVM_MINIMUM_MEMORY=1g
#      - JVM_MAXIMUM_MEMORY=12g
#      - JVM_CODE_CACHE_ARGS='-XX:InitialCodeCacheSize=1g -XX:ReservedCodeCacheSize=8g'
    depends_on:
      - mysql
    ports:
      - "7990:7990"
      - "7999:7999"
    volumes:
      - home_data:/var/bitbucket
    restart: always
    networks:
      - network-bridge

  mysql:
    image: mysql:8
    container_name: mysql-bitbucket
    environment:
      - TZ=Asia/Shanghai
      - MYSQL_DATABASE=bitbucket
      - MYSQL_ROOT_PASSWORD=123456
      - MYSQL_USER=bitbucket
      - MYSQL_PASSWORD=123123
    command: ['mysqld', '--character-set-server=utf8', '--collation-server=utf8_bin']
#    ports:
#      - "13306:3306"
    volumes:
      - mysql_data:/var/lib/mysql
    restart: always
    networks:
      - network-bridge

networks:
  network-bridge:
    driver: bridge

volumes:
  home_data:
    external: false
  mysql_data:
    external: false


  • 无标签

0 评论

你还没有登录。你所做的任何更改会将作者标记为匿名用户。 如果你已经拥有帐户,请登录