Dockerfile

FROM openjdk:11-bullseye
 
LABEL maintainer="waringid <waringid@gmail.com>" version="5.12.2"

ARG JIRA_VERSION=5.12.2
ARG JIRA_PRODUCT=servicedesk
ARG AGENT_VERSION=1.3.3
ARG MYSQL_DRIVER_VERSION=8.0.22

ENV JIRA_USER=jira \
    JIRA_GROUP=jira \
    JIRA_HOME=/var/jira-service \
    JIRA_INSTALL=/opt/jira-service \
    JVM_MINIMUM_MEMORY=1g \
    JVM_MAXIMUM_MEMORY=3g \
    JVM_CODE_CACHE_ARGS='-XX:InitialCodeCacheSize=1g -XX:ReservedCodeCacheSize=2g' \
    AGENT_PATH=/var/agent \
    AGENT_FILENAME=atlassian-agent.jar

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

COPY ./deps/${AGENT_FILENAME} ${AGENT_PATH}/
COPY ./deps/atlassian-${JIRA_PRODUCT}-${JIRA_VERSION}.tar.gz /tmp
COPY ./deps/mysql-connector-java-${MYSQL_DRIVER_VERSION}.jar  ${JIRA_INSTALL}/lib/

RUN openssl s_client -connect marketplace.atlassian.com:443 < /dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > /tmp/marketplace.atlassian.com.crt \
&& openssl s_client -connect marketplace-cdn.atlassian.com:443 < /dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > /tmp/marketplace-cdn.atlassian.com.crt \
&& openssl s_client -connect api.media.atlassian.com:443 < /dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > /tmp/api.atlassian.com.crt \
&& keytool -importcert -alias marketplace.atlassian.com -cacerts -storepass changeit -noprompt -file /tmp/marketplace.atlassian.com.crt \
&& keytool -importcert -alias marketplace-cdn.atlassian.com -cacerts -storepass changeit -noprompt -file /tmp/marketplace-cdn.atlassian.com.crt \
&& keytool -importcert -alias api.media.atlassian.com -cacerts -storepass changeit -noprompt -file /tmp/api.atlassian.com.crt

RUN mkdir -p ${JIRA_INSTALL} ${JIRA_HOME} ${AGENT_PATH} \
&&  tar xzf /tmp/atlassian-${JIRA_PRODUCT}-${JIRA_VERSION}.tar.gz -C ${JIRA_INSTALL}/ --strip-components 1 \
&& rm -f /tmp/atlassian-${JIRA_PRODUCT}-${JIRA_VERSION}.tar.gz \
&& echo "jira.home = ${JIRA_HOME}" > ${JIRA_INSTALL}/atlassian-jira/WEB-INF/classes/jira-application.properties

RUN export CONTAINER_USER=$JIRA_USER \
&& export CONTAINER_GROUP=$JIRA_GROUP \
&& groupadd -r $JIRA_GROUP && useradd -r -g $JIRA_GROUP $JIRA_USER \
&& chown -R $JIRA_USER:$JIRA_GROUP ${JIRA_INSTALL} ${JIRA_HOME}/ ${AGENT_PATH}
VOLUME $JIRA_HOME
USER $JIRA_USER
WORKDIR $JIRA_INSTALL
EXPOSE 8080

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

docker-compose

version: '3'
services:
 
  db:
    image: mysql:8.0
    container_name: mysql-jira
    command: ['mysqld','--character-set-server=utf8mb4','--collation-server=utf8mb4_bin','--default-authentication-plugin=mysql_native_password']
    ports:
      - "3306:3306"
    security_opt:
      - seccomp:unconfined
    environment:
      - MYSQL_ROOT_PASSWORD=password
      - TZ=Asia/Shanghai
      - MYSQL_DATABASE=jira_service
      - MYSQL_USER=jira
      - MYSQL_PASSWORD=password
    volumes:
      - /data/jira-service/mysql:/var/lib/mysql
    networks:
      jira_service-net:
  jira-service:
    image: jira-service:5.12.3
    container_name: jira-service
    ports:
      - "9000:8080"
    environment:
      - 'JVM_RESERVED_CODE_CACHE_SIZE=512m'
      - TZ=Asia/Shanghai
    volumes:
      - /data/jira-service/data:/var/jira-service
      - /etc/localtime:/etc/localtime:ro
    networks:
      jira_service-net:
    depends_on:
      - db

networks:
  jira_service-net:

注意

安装过程中会出现 /var/jira-service 无法写入的错误提示

  1. 停止当前的容器服务
  2. chmod 777 data
  3. 启动 JSD 容器服务
docker exec jira-service java -jar /var/agent/atlassian-agent.jar -p jsd -d -m a@b.com -n name -o http://127.0.0.1:8080 -s BB62-OSPA-MXLF-GRM0


  • 无标签