Skip to content

Commit

Permalink
Added ARM build
Browse files Browse the repository at this point in the history
  • Loading branch information
korridor committed Sep 10, 2024
1 parent 0782329 commit 5a2b539
Show file tree
Hide file tree
Showing 3 changed files with 113 additions and 6 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/build-private.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ name: Build - Private
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 10
timeout-minutes: 20

steps:
- name: "Check out code"
Expand Down Expand Up @@ -114,6 +114,9 @@ jobs:
type=semver,pattern={{major}}.{{minor}}
type=sha,format=long
- name: "Set up QEMU"
uses: docker/setup-qemu-action@v3

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

Expand All @@ -125,6 +128,7 @@ jobs:
DOCKER_FILES_BASE_PATH=docker/prod/
file: docker/prod/Dockerfile
push: true
platforms: linux/amd64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
Expand Down
90 changes: 90 additions & 0 deletions .github/workflows/build-public-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
on:
push:
tags:
- '*'
pull_request:
paths:
- '.github/workflows/build-public.yml'
- 'docker/prod/**'
workflow_dispatch:

name: Build - Public (Release)
jobs:
build:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
attestations: write
id-token: write
timeout-minutes: 90

steps:
- name: "Check out code"
uses: actions/checkout@v4

- name: "Copy .env template for production"
run: cp .env.production .env

- name: "Install dependencies"
uses: php-actions/composer@v6
if: steps.cache-vendor.outputs.cache-hit != 'true' # Skip if cache hit
with:
command: install
only_args: --no-dev --no-ansi --no-interaction --prefer-dist --ignore-platform-reqs --classmap-authoritative
php_version: 8.3

- name: "Use Node.js"
uses: actions/setup-node@v4
with:
node-version: '20.x'

- name: "Install npm dependencies"
run: npm ci

- name: "Build"
run: npm run build

- name: "Login to GitHub Container Registry"
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: "Login to GitHub Container Registry"
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: "Docker meta"
id: "meta"
uses: docker/metadata-action@v5
with:
images: |
solidtime/solidtime
ghcr.io/${{ github.repository }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: "Set up QEMU"
uses: docker/setup-qemu-action@v3

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

- name: "Build and push"
uses: docker/build-push-action@v6
with:
context: .
file: docker/prod/Dockerfile
build-args: |
DOCKER_FILES_BASE_PATH=docker/prod/
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
23 changes: 18 additions & 5 deletions .github/workflows/build-public.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ on:
branches:
- main
- develop
tags:
- '*'
pull_request:
paths:
- '.github/workflows/build-public.yml'
Expand All @@ -15,6 +13,11 @@ name: Build - Public
jobs:
build:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
attestations: write
id-token: write
timeout-minutes: 10

steps:
Expand Down Expand Up @@ -48,18 +51,28 @@ jobs:
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: "Login to GitHub Container Registry"
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: "Docker meta"
id: "meta"
uses: docker/metadata-action@v5
with:
images: solidtime/solidtime
images: |
solidtime/solidtime
ghcr.io/${{ github.repository }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: "Set up QEMU"
uses: docker/setup-qemu-action@v3

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

Expand All @@ -70,7 +83,7 @@ jobs:
file: docker/prod/Dockerfile
build-args: |
DOCKER_FILES_BASE_PATH=docker/prod/
platforms: linux/amd64
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
Expand Down

0 comments on commit 5a2b539

Please sign in to comment.