Skip to content

Commit 8f5bf13

Browse files
committed
ADD image push for feature branch builds
1 parent 5b993d0 commit 8f5bf13

File tree

6 files changed

+51
-29
lines changed

6 files changed

+51
-29
lines changed

.github/workflows/build-and-push.yml

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,43 @@
11
name: Build and Push to DockerHub
22

3-
on:
4-
release:
5-
types: [published]
3+
on: push
64

75
env:
8-
REGISTRY: docker.io
6+
COMMIT_SHA: ${{ git rev-parse HEAD }}
97
IMAGE_NAME: appwrite/base
8+
REGISTRY: docker.io
109
TAG: ${{ github.event.release.tag_name }}
1110

1211
jobs:
13-
build:
12+
build_sha:
13+
if: github.ref != 'refs/heads/main'
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout the repo
17+
uses: actions/checkout@v6.0.2
18+
19+
- name: Login to DockerHub
20+
uses: docker/login-action@v4
21+
with:
22+
username: ${{ secrets.DOCKERHUB_USERNAME }}
23+
password: ${{ secrets.DOCKERHUB_TOKEN }}
24+
25+
- name: Set up QEMU
26+
uses: docker/setup-qemu-action@v4
27+
28+
- name: Set up Docker Buildx
29+
uses: docker/setup-buildx-action@v4
30+
31+
- name: Build and push
32+
uses: docker/build-push-action@v4
33+
with:
34+
context: .
35+
platforms: linux/amd64,linux/arm64
36+
push: true
37+
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.COMMIT_SHA }}
38+
39+
build_release:
40+
if: github.ref == 'refs/heads/main'
1441
runs-on: ubuntu-latest
1542
steps:
1643
- name: Checkout the repo

.github/workflows/test.yml renamed to .github/workflows/container-structure-.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- name: Checkout the repo
1515
uses: actions/checkout@v6.0.2
1616

17-
- name: Setup container structure test
17+
- name: Setup container-structure-test
1818
run: |
1919
curl -LO https://storage.googleapis.com/container-structure-test/latest/container-structure-test-linux-amd64
2020
chmod +x container-structure-test-linux-amd64
Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
1-
name: PR Security Scan
1+
name: trivy
22

3-
on: push
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
# The branches below must be a subset of the branches above
8+
branches: [ "main" ]
9+
schedule:
10+
- cron: '43 11 * * 6'
411

512
permissions:
613
contents: read

.github/workflows/trivy.yml

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,6 @@
1-
# This workflow uses actions that are not certified by GitHub.
2-
# They are provided by a third-party and are governed by
3-
# separate terms of service, privacy policy, and support
4-
# documentation.
1+
name: Trivy Scan
52

6-
name: trivy
7-
8-
on:
9-
push:
10-
branches: [ "main" ]
11-
pull_request:
12-
# The branches below must be a subset of the branches above
13-
branches: [ "main" ]
14-
schedule:
15-
- cron: '43 11 * * 6'
3+
on: push
164

175
permissions:
186
contents: read

CHANGES.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* .dockerignore
88
* .github/workflows/pr-scan.yml to scan all commit pushes for vulnerabilities
99
* base_image and php_build_date to containber labels
10-
* CHANGELOG.md
10+
* container image build action to publish image using commit sha
1111

1212
### Change
1313

TODO.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# TODO
22

33
- [add dive analysis to project](https://github.com/marketplace/actions/dive-action)
4-
- install gd and run stage should be separate
5-
- xdebug should not be in a production image
4+
- audit system packages in Dockerfile -> final
65
- can we get pre-compiled extensions *.so
7-
- xdebug as separate image `appwrite-XYZ-xdebug`
8-
- use Swoole base image
6+
- can we merge checkout, login, setup qemu, setup buildx in build-and-push.yml
7+
- capture build logs via ` | tee "build-$(date +%s).log"`
98
- changelog aligning with appwrite/appwrite
109
- DOCKER_BUILDKIT=1 + buildx to parallel build the PHP extensions
11-
- audit system packages in Dockerfile -> final
12-
- capture build logs via ` | tee "build-$(date +%s).log"`
10+
- install gd and run stage should be separate
11+
- use Swoole base image
12+
- xdebug as separate image `appwrite/base-xdebug`

0 commit comments

Comments
 (0)