Skip to content

Commit

Permalink
feat(.drone.jsonnet): add support for building and pushing Docker ima…
Browse files Browse the repository at this point in the history
…ges only when on the main branch

feat(.drone.jsonnet): add support for building Docker images without pushing when on any branch other than main
  • Loading branch information
masterkain committed Jul 7, 2023
1 parent c9c5fb9 commit adf3d4a
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 8 deletions.
38 changes: 30 additions & 8 deletions .drone.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@
clone: {
depth: 1,
},
trigger: {
branch: ['main'],
event: {
include: ['push'],
},
},
steps: [
{
name: 'tag',
Expand All @@ -25,15 +19,14 @@
},
},
{
name: 'build',
name: 'build-and-push',
image: 'thegeeklab/drone-docker-buildx',
privileged: true,
depends_on: ['tag'],
settings: {
debug: true,
purge: true,
no_cache: true,
// platforms: ['linux/amd64', 'linux/arm64'],
platforms: ['linux/amd64'],
repo: 'ghcr.io/icoretech/airbroke',
registry: 'ghcr.io/icoretech',
Expand All @@ -43,6 +36,35 @@
password: {
from_secret: 'github_packages_pat',
},
when: {
branch: ['main'],
},
},
},
{
name: 'build-no-push',
image: 'thegeeklab/drone-docker-buildx',
privileged: true,
depends_on: ['tag'],
settings: {
dry_run: true,
debug: true,
purge: true,
no_cache: true,
platforms: ['linux/amd64'],
repo: 'ghcr.io/icoretech/airbroke',
registry: 'ghcr.io/icoretech',
username: {
from_secret: 'github_packages_username',
},
password: {
from_secret: 'github_packages_pat',
},
when: {
branch: {
exclude: ['main'],
},
},
},
},
],
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ build:

resetdb: stop
docker compose run --rm web npx prisma migrate reset --force

# dummy rule that prevents make from printing an error message for
# any targets that were not defined
%:
Expand Down

0 comments on commit adf3d4a

Please sign in to comment.