UNCLASSIFIED

Dockerfile 3.36 KB
Newer Older
Jeffrey Weatherford's avatar
Jeffrey Weatherford committed
1
ARG BASE_REGISTRY=repo.dso.mil
Jeffrey Weatherford's avatar
Jeffrey Weatherford committed
2 3
ARG BASE_IMAGE=ironbank/redhat/openjdk/openjdk11
ARG BASE_TAG=1.11
Ruben Vila-Morales's avatar
Ruben Vila-Morales committed
4 5
FROM ${BASE_REGISTRY}/${BASE_IMAGE}:${BASE_TAG}

6 7 8 9
ENV RUN_USER                                        jira
ENV RUN_GROUP                                       jira
ENV RUN_UID                                         2001
ENV RUN_GID                                         2001
10

11 12 13
# https://confluence.atlassian.com/display/JSERVERM/Important+directories+and+files
ENV JIRA_HOME                                       /var/atlassian/application-data/jira
ENV JIRA_INSTALL_DIR                                /opt/atlassian/jira
14

15
WORKDIR $JIRA_HOME
Ruben Vila-Morales's avatar
Ruben Vila-Morales committed
16

17 18
# Expose HTTP port
EXPOSE 8080
jhunt's avatar
jhunt committed
19 20 21
# JIRA Cluster Sync Port
EXPOSE 40001

Ruben Vila-Morales's avatar
Ruben Vila-Morales committed
22

23 24
CMD ["/entrypoint.py"]
ENTRYPOINT ["/usr/bin/tini", "--"]
evan.rush's avatar
evan.rush committed
25

26
USER root
Jeffrey Weatherford's avatar
Jeffrey Weatherford committed
27 28

COPY dumb-init-1.2.2-6.el8.x86_64.rpm /opt/
Ruben Vila-Morales's avatar
Ruben Vila-Morales committed
29

30
RUN dnf -y update && dnf -y upgrade && \
Kenneth Urban's avatar
Kenneth Urban committed
31
    dnf -y install fontconfig python3 python3-jinja2 unzip && \
Jeffrey Weatherford's avatar
Jeffrey Weatherford committed
32
    rpm -Uvh /opt/dumb-init-1.2.2-6.el8.x86_64.rpm
Ruben Vila-Morales's avatar
Ruben Vila-Morales committed
33

Kenneth Urban's avatar
8.19.0  
Kenneth Urban committed
34 35
ARG JIRA_VERSION=8.19.0
ARG JSM_VERSION=4.19.0
36
ARG ARTEFACT_NAME=atlassian-jira-software
Kenneth Urban's avatar
Kenneth Urban committed
37

jhunt's avatar
jhunt committed
38
COPY atlassian-jira-software-${JIRA_VERSION}.tar.gz /opt/
Kenneth Urban's avatar
Kenneth Urban committed
39
COPY jira-servicedesk-application-${JSM_VERSION}.obr /opt/
40 41 42 43 44

RUN groupadd --gid ${RUN_GID} ${RUN_GROUP} \
    && useradd --uid ${RUN_UID} --gid ${RUN_GID} --home-dir ${JIRA_HOME} --shell /bin/bash ${RUN_USER} \
    && echo PATH=$PATH > /etc/environment \
    \
Jeffrey Weatherford's avatar
Jeffrey Weatherford committed
45
    && mkdir -p                                     ${JIRA_INSTALL_DIR} \
jhunt's avatar
jhunt committed
46
    &&  tar -xzf /opt/atlassian-jira-software-${JIRA_VERSION}.tar.gz --strip-components 1 -C /opt/atlassian/jira/ \
Jeffrey Weatherford's avatar
Jeffrey Weatherford committed
47
    &&  chmod -R "u=rwX,g=rX,o=rX"                   ${JIRA_INSTALL_DIR}/ \
Jeffrey Weatherford's avatar
Jeffrey Weatherford committed
48
    &&  chown -R ${RUN_USER}:${RUN_GROUP}            ${JIRA_INSTALL_DIR}/ \
49 50 51
    \
    && sed -i -e 's/^JVM_SUPPORT_RECOMMENDED_ARGS=""$/: \${JVM_SUPPORT_RECOMMENDED_ARGS:=""}/g' ${JIRA_INSTALL_DIR}/bin/setenv.sh \
    && sed -i -e 's/^JVM_\(.*\)_MEMORY="\(.*\)"$/: \${JVM_\1_MEMORY:=\2}/g' ${JIRA_INSTALL_DIR}/bin/setenv.sh \
Kenneth Urban's avatar
Kenneth Urban committed
52 53 54 55 56 57 58 59 60 61
    && sed -i -e 's/-XX:ReservedCodeCacheSize=\([0-9]\+[kmg]\)/-XX:ReservedCodeCacheSize=${JVM_RESERVED_CODE_CACHE_SIZE:=\1}/g' ${JIRA_INSTALL_DIR}/bin/setenv.sh 

#Install JSM
RUN  unzip /opt/jira-servicedesk-application-${JSM_VERSION}.obr -d /opt/jsm \
    && ls /opt/jsm/dependencies/*.jar 1> /dev/null 2>&1 \
    && mkdir -p ${JIRA_HOME}/plugins/installed-plugins/ \
    && cp /opt/jsm/dependencies/*.jar ${JIRA_HOME}/plugins/installed-plugins/ \
    && cp /opt/jsm/*.jar ${JIRA_HOME}/plugins/installed-plugins/

RUN touch /etc/container_id \
62 63 64 65 66 67
    && chown ${RUN_USER}:${RUN_GROUP}               /etc/container_id \
    && chown -R ${RUN_USER}:${RUN_GROUP}            ${JIRA_HOME}

VOLUME ["${JIRA_HOME}"] # Must be declared after setting perms

COPY scripts/entrypoint.py \
Jeffrey Weatherford's avatar
Jeffrey Weatherford committed
68
     scripts/entrypoint_helpers.py  /
69 70
COPY scripts/shared-components/support                      /opt/atlassian/support
COPY config/*                                       /opt/atlassian/etc/
Ruben Vila-Morales's avatar
Ruben Vila-Morales committed
71

jhunt's avatar
jhunt committed
72 73
#### Clean up ####
RUN rm -rf /opt/dumb-init-1.2.2-6.el8.x86_64.rpm && dnf clean all && rm -rf /opt/${ARTEFACT_NAME}-${JIRA_VERSION}.tar.gz
Kenneth Urban's avatar
Kenneth Urban committed
74
RUN rm -rf /opt/jira-servicedesk-application-{$JSM_VERSION}.obr && rm -rf /opt/jsm && dnf -y remove unzip
jhunt's avatar
jhunt committed
75

jhunt's avatar
jhunt committed
76 77 78 79 80
#
# HEALTHCHECK
#
HEALTHCHECK --start-period=5m --interval=3m --timeout=3s \
  CMD curl -f http://localhost:8080/ || exit 1
jhunt's avatar
jhunt committed
81 82 83 84 85 86 87
  
#
# RUN
#
USER ${RUN_USER}
ENTRYPOINT ["/entrypoint.py"]
CMD ["${JIRA_INSTALL_DIR}/bin/catalina.sh", "run"]
Ruben Vila-Morales's avatar
Ruben Vila-Morales committed
88