mirror of
https://github.com/mashirozx/docker-php-nginx.git
synced 2024-11-22 14:58:15 +08:00
Merge pull request #75 from TrafeX/multi-arch-builds
Add multi-arch Docker builds
This commit is contained in:
commit
61f31882ce
@ -8,19 +8,26 @@ on:
|
|||||||
|
|
||||||
env:
|
env:
|
||||||
IMAGE_NAME: trafex/php-nginx
|
IMAGE_NAME: trafex/php-nginx
|
||||||
|
IMAGE_TAG: ${{ github.sha }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
deploy:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v1
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
id: buildx
|
||||||
|
uses: docker/setup-buildx-action@v1
|
||||||
|
|
||||||
- name: Build image
|
- name: Build image
|
||||||
run: |-
|
run: |-
|
||||||
docker build -t $IMAGE_NAME .
|
docker build -t $IMAGE_NAME:$IMAGE_TAG .
|
||||||
docker tag $IMAGE_NAME:latest $IMAGE_NAME:${{ github.sha }}
|
|
||||||
|
|
||||||
- name: Smoke test image
|
- name: Smoke test image
|
||||||
run: |-
|
run: |-
|
||||||
@ -47,17 +54,26 @@ jobs:
|
|||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Push latest image
|
- name: Build multi-arch image and push latest tag
|
||||||
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
|
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
|
||||||
run: |-
|
run: |-
|
||||||
docker push $IMAGE_NAME:latest
|
docker buildx build \
|
||||||
|
--cache-from=$IMAGE_NAME:latest
|
||||||
|
--push \
|
||||||
|
-t $IMAGE_NAME:latest \
|
||||||
|
--platform linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6 \
|
||||||
|
.
|
||||||
|
|
||||||
- name: Set tag in environment
|
- name: Set tag in environment
|
||||||
if: contains(github.ref, 'refs/tags/')
|
if: contains(github.ref, 'refs/tags/')
|
||||||
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
|
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Push tagged image
|
- name: Build multi-arch image and push release tag
|
||||||
if: contains(github.ref, 'refs/tags/')
|
if: contains(github.ref, 'refs/tags/')
|
||||||
run: |-
|
run: |-
|
||||||
docker tag $IMAGE_NAME:${{ github.sha }} $IMAGE_NAME:$RELEASE_VERSION
|
docker buildx build \
|
||||||
docker push $IMAGE_NAME:$RELEASE_VERSION
|
--cache-from=$IMAGE_NAME:latest
|
||||||
|
--push \
|
||||||
|
-t $IMAGE_NAME:$RELEASE_VERSION \
|
||||||
|
--platform linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6 \
|
||||||
|
.
|
@ -1,6 +1,7 @@
|
|||||||
version: '3.5'
|
version: '3.5'
|
||||||
services:
|
services:
|
||||||
app:
|
app:
|
||||||
|
image: ${IMAGE_NAME}:${IMAGE_TAG}
|
||||||
build: .
|
build: .
|
||||||
sut:
|
sut:
|
||||||
image: alpine:3.13
|
image: alpine:3.13
|
||||||
|
Loading…
Reference in New Issue
Block a user