diff --git a/.github/workflows/build-tagged-image.yml b/.github/workflows/build-dev-image.yml similarity index 52% rename from .github/workflows/build-tagged-image.yml rename to .github/workflows/build-dev-image.yml index 65d64f7..7b510c7 100644 --- a/.github/workflows/build-tagged-image.yml +++ b/.github/workflows/build-dev-image.yml @@ -1,47 +1,51 @@ -name: Build & Push Docker Image to GitHub +name: Build & Push Jira Development Docker Image to GHCR on: + pull_request: + branches: + - develop push: - tags: - - "*.*.*" + branches: + - develop env: REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository }} + IMAGE_NAME: slickdeals/jira-software + 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 }} - + password: ${{ env.GITHUB_TOKEN }} + env: + GITHUB_USER: ${{ github.actor }} + GITHUB_TOKEN: ${{ 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 }} - - - name: Build and push Docker image - uses: docker/build-push-action@v2 + tags: | + ${{ env.COMMIT_SHA }} + ${{ vars.DEVELOP_TAG}} + - name: Build, Tag, and push Docker image + 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 }} \ No newline at end of file diff --git a/.github/workflows/build-release-image.yml b/.github/workflows/build-release-image.yml new file mode 100644 index 0000000..f0284a7 --- /dev/null +++ b/.github/workflows/build-release-image.yml @@ -0,0 +1,53 @@ +name: Build & Push Jira Release Docker Image to GHCR + +on: + pull_request: + branches: + - main + push: + branches: + - main + +env: + REGISTRY: ghcr.io + IMAGE_NAME: slickdeals/jira-software + 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 + with: + buildkitd-flags: debug + - name: Login to GHCR + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ env.GITHUB_TOKEN }} + env: + GITHUB_USER: ${{ github.actor }} + GITHUB_TOKEN: ${{ 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 }} diff --git a/README.md b/README.md index 3cac262..6b5d1dd 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/app/Dockerfile b/app/Dockerfile index 1cc6687..41b3fd7 100644 --- a/app/Dockerfile +++ b/app/Dockerfile @@ -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