Skip to content

Remove Heroku-specific code and references #1892

Remove Heroku-specific code and references

Remove Heroku-specific code and references #1892

Workflow file for this run

name: Docker Build
on:
push:
branches:
- main
- dev
pull_request:
branches:
- main
- dev
workflow_dispatch:
permissions: {}
jobs:
build:
name: Build Docker Image
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
env:
DEPLOY: ${{ github.repository == 'mozilla/pontoon' && github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev') }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@37fe631027851001ddb9b187196cc803df7f5f0e # v4.3.0
- name: Build Docker image
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0
with:
context: .
file: docker/Dockerfile-mozcloud
build-args: |
GIT_REVISION=${{ github.sha }}
BUILDKIT_DOCKERFILE_CHECK=skip=SecretsUsedInArgOrEnv
push: false
load: true
tags: pontoon:latest
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Tag image for GAR
id: tag
if: env.DEPLOY == 'true'
run: |
# Get the short commit SHA from GitHub context
SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-7)
# Get branch name from GitHub context
BRANCH_NAME=$(echo "${GITHUB_REF_NAME}")
# Construct GAR image tag
GAR_TAG="us-docker.pkg.dev/${GCP_PROJECT_ID}/pontoon-prod/pontoon:${BRANCH_NAME}-${SHORT_SHA}"
# Tag the built image
docker tag pontoon:latest ${GAR_TAG}
# Output the tag for the push action
echo "image_tags=${GAR_TAG}" >> $GITHUB_OUTPUT
env:
GCP_PROJECT_ID: ${{ vars.GCP_PROJECT_ID }}
- name: Push Docker image to GAR
if: env.DEPLOY == 'true'
uses: mozilla-it/deploy-actions/docker-push@ef0f037316873ff408a598f1cd98876dd7851e53 # v6.7.0
with:
image_tags: ${{ steps.tag.outputs.image_tags }}
project_id: ${{ vars.GCP_PROJECT_ID }}
service_account_name: artifact-writer
workload_identity_pool_project_number: ${{ vars.MOZCLOUD_WORKLOAD_IDENTITY_POOL_PROJECT_NUMBER }}