cptactionhank / docker-atlassian-jira-software

Atlassian JIRA Software wrapped in a Docker image
https://cptactionhank.github.io/docker-atlassian-jira-software
MIT License
270 stars 168 forks source link

Force use of Jira Software V8.x #63

Closed tyndyll closed 4 years ago

tyndyll commented 5 years ago

Fixes: #61

Updated prepare script to explicitly pull the V8.x version of the Atlassian Software tarball. Removed unused script parameter and forced the Dockerfile to use the environmental variable to pull the code rather than having to update it in place

By submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.

tyndyll commented 5 years ago

Test output

tyndyll@serenity:~/docker-atlassian-jira-software$ bin/prepare
Obtaining Altassian JIRA version information...
Found versions:
  Current: 8.0.2
  Latest:  8.1.0

Preparing branch for version new Atlassian JIRA version
Ready for acceptance testing
tyndyll@serenity:~/docker-atlassian-jira-software$ cat Dockerfile
FROM openjdk:8-alpine

# Configuration variables.
ENV JIRA_HOME     /var/atlassian/jira
ENV JIRA_INSTALL  /opt/atlassian/jira
ENV JIRA_VERSION  8.1.0

# Install Atlassian JIRA and helper tools and setup initial home
# directory structure.
RUN set -x \
    && apk add --no-cache curl xmlstarlet bash ttf-dejavu libc6-compat \
    && mkdir -p                "${JIRA_HOME}" \
    && mkdir -p                "${JIRA_HOME}/caches/indexes" \
    && chmod -R 700            "${JIRA_HOME}" \
    && chown -R daemon:daemon  "${JIRA_HOME}" \
    && mkdir -p                "${JIRA_INSTALL}/conf/Catalina" \
    && curl -Ls                "https://www.atlassian.com/software/jira/downloads/binary/atlassian-jira-software-${JIRA_VERSION}.tar.gz" | tar -xz --directory "${JIRA_INSTALL}" --strip-components=1 --no-same-owner \
    && curl -Ls                "https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.38.tar.gz" | tar -xz --directory "${JIRA_INSTALL}/lib" --strip-components=1 --no-same-owner "mysql-connector-java-5.1.38/mysql-connector-java-5.1.38-bin.jar" \
    && rm -f                   "${JIRA_INSTALL}/lib/postgresql-9.1-903.jdbc4-atlassian-hosted.jar" \
    && curl -Ls                "https://jdbc.postgresql.org/download/postgresql-42.2.1.jar" -o "${JIRA_INSTALL}/lib/postgresql-42.2.1.jar" \
    && chmod -R 700            "${JIRA_INSTALL}/conf" \
    && chmod -R 700            "${JIRA_INSTALL}/logs" \
    && chmod -R 700            "${JIRA_INSTALL}/temp" \
    && chmod -R 700            "${JIRA_INSTALL}/work" \
    && chown -R daemon:daemon  "${JIRA_INSTALL}/conf" \
    && chown -R daemon:daemon  "${JIRA_INSTALL}/logs" \
    && chown -R daemon:daemon  "${JIRA_INSTALL}/temp" \
    && chown -R daemon:daemon  "${JIRA_INSTALL}/work" \
    && sed --in-place          "s/java version/openjdk version/g" "${JIRA_INSTALL}/bin/check-java.sh" \
    && echo -e                 "\njira.home=$JIRA_HOME" >> "${JIRA_INSTALL}/atlassian-jira/WEB-INF/classes/jira-application.properties" \
    && touch -d "@0"           "${JIRA_INSTALL}/conf/server.xml"

# Use the default unprivileged account. This could be considered bad practice
# on systems where multiple processes end up being executed by 'daemon' but
# here we only ever run one process anyway.
USER daemon:daemon

# Expose default HTTP connector port.
EXPOSE 8080

# Set volume mount points for installation and home directory. Changes to the
# home directory needs to be persisted as well as parts of the installation
# directory due to eg. logs.
VOLUME ["/var/atlassian/jira", "/opt/atlassian/jira/logs"]

# Set the default working directory as the installation directory.
WORKDIR /var/atlassian/jira

COPY "docker-entrypoint.sh" "/"
ENTRYPOINT ["/docker-entrypoint.sh"]

# Run Atlassian JIRA as a foreground process by default.
CMD ["/opt/atlassian/jira/bin/start-jira.sh", "-fg"]
tyndyll commented 5 years ago

NOTE: This resolves the 8.x version problem, as the JSON file being pulled currently has the most recent version of 7.x and 8.x available. It would be possible to set up additional dockerfile for both versions (e,g. either 2 separate Dockerfiles or using ARG parameters), but this would require some additional setup either in the DockerHub build to tag the versions appropriately, or to push from CircleCI to DockerHub.

Happy to help, but outside the scope of this PR :)

tyndyll commented 5 years ago

WRT merge conflict - this can be merged using my solution. The current master is the hard coded version from CI