Skip to content

Commit d989a90

Browse files
authored
Merge pull request #3 from fontebasso/php8
enable github actions to build and push images docker
2 parents 93179c3 + 910f319 commit d989a90

File tree

3 files changed

+35
-3
lines changed

3 files changed

+35
-3
lines changed

.github/workflows/build.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
on:
2+
release:
3+
types: [published]
4+
5+
jobs:
6+
build-push-image:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Publish version env var
10+
run: echo "VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
11+
12+
- name: checkout code
13+
uses: actions/checkout@v2
14+
15+
- name: Login to Docker Hub
16+
uses: docker/login-action@v1
17+
with:
18+
username: ${{ secrets.DOCKERHUB_USERNAME }}
19+
password: ${{ secrets.DOCKERHUB_TOKEN }}
20+
21+
- name: Set up Docker Buildx
22+
id: buildx
23+
uses: docker/setup-buildx-action@v1
24+
25+
- name: build and push the image
26+
run: |
27+
docker buildx build . \
28+
--build-arg BUILD_ID=${{ github.run_id }}
29+
--build-arg COMMIT_ID=$(git rev-parse --short "$GITHUB_SHA")
30+
--tag ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_REPO }}:${{ env.VERSION }} \
31+
--tag ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_REPO }}:latest \
32+
--platform linux/amd64,linux/arm64
33+
--push

Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@ ARG NAME_IMAGE_TAG='8.0-fpm-alpine3.13'
44
FROM ${NAME_IMAGE_BASE}:${NAME_IMAGE_TAG}
55

66
ARG BUILD_ID="unknown"
7+
ARG COMMIT_ID="unknown"
78
ARG VERSION_OS='3.13'
89
ARG VERSION_PHP='8.0'
910

1011
LABEL \
1112
ALPINE="$VERSION_OS" \
1213
BUILD_ID="$BUILD_ID" \
14+
COMMIT_ID="$COMMIT_ID" \
1315
MAINTAINER='Samuel Fontebasso <[email protected]>' \
1416
PHP_VERSION="$VERSION_PHP"
1517

hooks/build

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)