Skip to content

Commit

Permalink
Merge pull request #3 from Slickdeals/OPS-10298-update-jira
Browse files Browse the repository at this point in the history
Rework Jira Docker image pipleine
  • Loading branch information
Wicaeed authored Mar 19, 2024
2 parents 3cf21ad + 255f812 commit 5f14733
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 21 deletions.
Original file line number Diff line number Diff line change
@@ -1,47 +1,47 @@
name: Build & Push Docker Image to GitHub
name: Build & Push Jira Development Docker Image to GHCR

on:
pull_request:
push:
tags:
- "*.*.*"
branches:
- develop

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
COMMIT_SHA: ${{ github.sha }}

jobs:
build_image:
runs-on: ubuntu-latest
steps:
- name: Checkout code
- name: Checkout
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to GHCR
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata for the Docker image
id: meta
uses: docker/metadata-action@v5.0.0
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

tags: |
${{ env.COMMIT_SHA }}
${{ vars.DEVELOP_TAG}}
- name: Build and push Docker image
uses: docker/build-push-action@v2
uses: docker/build-push-action@v5
with:
context: ./app
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
tags: ${{ env.COMMIT_SHA }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
RELEASE_TAG=${{ vars.RELEASE_TAG }}
BUILD_TAG=${{ vars.DEVELOP_TAG }}
46 changes: 46 additions & 0 deletions .github/workflows/build-release-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Build & Push Jira Release Docker Image to GHCR

on:
push:
branches:
- main

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
COMMIT_SHA: ${{ github.sha }}

jobs:
build_image:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GHCR
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata for the Docker image
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
${{ env.COMMIT_SHA }}
${{ vars.RELEASE_TAG}}
- name: Build, Tag, and push Docker image
uses: docker/build-push-action@v5
with:
context: ./app
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ env.COMMIT_SHA }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
BUILD_TAG=${{ vars.RELEASE_TAG }}
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
# Jira Software

This repo is responsible for creating the Jira Software image used for our on-prem Jira servers.
This repo is responsible for creating the Atlassian Jira Docker image for our internal use.

There's not a lot going on in repo itself other than defining a Dockerfile and gitlab-ci.yml file for the CI/CD pipeline.
There's not a lot going on in repo itself other than defining a Dockerfile and a few GitHub Actions.

## Usage
To build an image for Jira Software, simply trigger a new run of the default pipeline for this repo via the [GitLab UI](https://it-gitlab.slickdeals.dev/itops/jira-software/-/pipelines)

Set a variable `DEFAULT_RELEASE_TAG` to configure the image version to build.
The image will be built from the Dockerfile in the `app` folder of this repo. There are two images that will be built from these pipelines, an image for use with our Dev environment, and an image for our Production Jira instance.

Ensure you only use semVer format for the `DEFAULT_RELEASE_TAG` variable, or simply leave it unset to run a build against whatever image is currently present at the `latest` tag from the [upstream Docker Hub repo](https://hub.docker.com/r/atlassian/jira-software/tags?page=1&name=latest)
Once built, the Docker Image will be tagged with the Git Commit SHA and the version of Jira Software that was used to build the image.


The resulting new image will be automatically saved into this Project's [Container Registry](https://it-gitlab.slickdeals.dev/itops/jira-software/container_registry) and should be pullable with Docker CLI from there.
The resulting image will be pushed to the Slickdeals GHCR for use on our systems.
4 changes: 2 additions & 2 deletions app/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ARG RELEASE_TAG=latest
ARG BUILD_TAG=latest

FROM atlassian/jira-software:${RELEASE_TAG}-jdk11
FROM atlassian/jira-software:${BUILD_TAG}-jdk11

RUN apt-get update && apt-get install wget

Expand Down

0 comments on commit 5f14733

Please sign in to comment.