Merge pull request #1113 from saithsab877/feature/add-common-nav-to-n… #98
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docker build on push | |
env: | |
DOCKER_CLI_EXPERIMENTAL: enabled | |
on: | |
push: | |
tags: '*' | |
jobs: | |
build_amd64: | |
runs-on: ubuntu-24.04 | |
name: Build Tribes AMD64 image | |
env: | |
ACTIONS_ALLOW_UNSECURE_COMMANDS: true | |
steps: | |
- name: Setup env | |
run: | | |
echo "PLATFORM=linux/amd64" | tee -a $GITHUB_ENV | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
${{ secrets.DOCKER_HUB_USER }}/sphinx-tribes-frontend | |
- name: Checkout project | |
uses: actions/checkout@v4 | |
- name: Setup Docker buildx action | |
uses: docker/setup-buildx-action@v3 | |
- name: Cache Docker layers | |
uses: actions/cache@v4 | |
id: cache | |
with: | |
path: ${{ runner.temp }}/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- name: Run Docker buildx | |
id: build | |
uses: docker/build-push-action@v6 | |
with: | |
platforms: ${{ env.PLATFORM }} | |
cache-from: type=local,src=${{ runner.temp }}/.buildx-cache | |
cache-to: type=local,dest=${{ runner.temp }}/.buildx-cache-new,mode=max | |
build-args: | | |
REACT_APP_PUBLIC_POSTHOG_KEY=${{ secrets.REACT_APP_PUBLIC_POSTHOG_KEY }} | |
REACT_APP_PUBLIC_POSTHOG_HOST=${{ secrets.REACT_APP_PUBLIC_POSTHOG_HOST }} | |
labels: ${{ steps.meta.outputs.labels }} | |
outputs: type=image,"name=${{ secrets.DOCKER_HUB_USER }}/sphinx-tribes-frontend",push-by-digest=true,push=true,name-canonical=true | |
- name: Export digest | |
run: | | |
mkdir -p ${{ runner.temp }}/digests | |
digest="${{ steps.build.outputs.digest }}" | |
touch "${{ runner.temp }}/digests/${digest#sha256:}" | |
- name: Upload digest artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: digests-amd64 | |
path: ${{ runner.temp }}/digests/* | |
if-no-files-found: error | |
retention-days: 1 | |
- # Temp fix | |
# https://github.com/docker/build-push-action/issues/252 | |
# https://github.com/moby/buildkit/issues/1896 | |
name: Move cache | |
run: | | |
rm -rf ${{ runner.temp }}/.buildx-cache | |
mv ${{ runner.temp }}/.buildx-cache-new ${{ runner.temp }}/.buildx-cache | |
build_arm7: | |
runs-on: ubuntu-24.04-arm | |
name: Build Tribes ARMv7 image | |
env: | |
ACTIONS_ALLOW_UNSECURE_COMMANDS: true | |
steps: | |
- name: Setup env | |
run: | | |
echo "PLATFORM=linux/arm/v7" | tee -a $GITHUB_ENV | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
${{ secrets.DOCKER_HUB_USER }}/sphinx-tribes-frontend | |
- name: Checkout project | |
uses: actions/checkout@v4 | |
- name: Setup Docker buildx action | |
uses: docker/setup-buildx-action@v3 | |
- name: Cache Docker layers | |
uses: actions/cache@v4 | |
id: cache | |
with: | |
path: ${{ runner.temp }}/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- name: Run Docker buildx | |
id: build | |
uses: docker/build-push-action@v6 | |
with: | |
platforms: ${{ env.PLATFORM }} | |
cache-from: type=local,src=${{ runner.temp }}/.buildx-cache | |
cache-to: type=local,dest=${{ runner.temp }}/.buildx-cache-new,mode=max | |
build-args: | | |
REACT_APP_PUBLIC_POSTHOG_KEY=${{ secrets.REACT_APP_PUBLIC_POSTHOG_KEY }} | |
REACT_APP_PUBLIC_POSTHOG_HOST=${{ secrets.REACT_APP_PUBLIC_POSTHOG_HOST }} | |
labels: ${{ steps.meta.outputs.labels }} | |
outputs: type=image,"name=${{ secrets.DOCKER_HUB_USER }}/sphinx-tribes-frontend",push-by-digest=true,push=true,name-canonical=true | |
- name: Export digest | |
run: | | |
mkdir -p ${{ runner.temp }}/digests | |
digest="${{ steps.build.outputs.digest }}" | |
touch "${{ runner.temp }}/digests/${digest#sha256:}" | |
- name: Upload digest artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: digests-arm7 | |
path: ${{ runner.temp }}/digests/* | |
if-no-files-found: error | |
retention-days: 1 | |
- # Temp fix | |
# https://github.com/docker/build-push-action/issues/252 | |
# https://github.com/moby/buildkit/issues/1896 | |
name: Move cache | |
run: | | |
rm -rf ${{ runner.temp }}/.buildx-cache | |
mv ${{ runner.temp }}/.buildx-cache-new ${{ runner.temp }}/.buildx-cache | |
create_and_push_manifest: | |
runs-on: ubuntu-24.04 | |
needs: | |
- build_amd64 | |
- build_arm7 | |
steps: | |
- name: Download digest artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: ${{ runner.temp }}/digests | |
pattern: digests-* | |
merge-multiple: true | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Setup Docker buildx action | |
uses: docker/setup-buildx-action@v3 | |
- name: Docker image tags | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
${{ secrets.DOCKER_HUB_USER }}/sphinx-tribes-frontend | |
tags: | | |
type=raw,value=latest | |
type=semver,pattern={{raw}} | |
- name: Create manifest list and push | |
working-directory: ${{ runner.temp }}/digests | |
run: | | |
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ | |
$(printf '${{ secrets.DOCKER_HUB_USER }}/sphinx-tribes-frontend@sha256:%s ' *) |