feat: optimize builds with Docker Buildx and Bake
ci/woodpecker/push/woodpecker Pipeline was successful Details

This commit is contained in:
Leopere 2025-04-04 20:06:57 -04:00
parent 0103cc87e4
commit b95b44d1d9
2 changed files with 56 additions and 0 deletions

View File

@ -146,4 +146,25 @@ steps:
when:
branch: main
event: [push, cron]
status: success
pipeline:
build:
image: docker:24.0.7
commands:
- apk add --no-cache git
- docker buildx create --use
- docker buildx bake --file docker-bake.hcl --set *.platform=linux/amd64 --push
when:
event: push
branch: main
deploy:
image: docker:24.0.7
commands:
- apk add --no-cache git
- docker stack deploy --with-registry-auth -c ./stack.staging.yml ${CI_REPO_NAME}-staging
when:
event: push
branch: main
status: success

35
docker-bake.hcl Normal file
View File

@ -0,0 +1,35 @@
variable "REGISTRY" {
default = "git.nixc.us/colin"
}
variable "TAG" {
default = "latest"
}
group "default" {
targets = ["staging", "production"]
}
target "staging" {
context = "."
dockerfile = "Dockerfile"
tags = ["${REGISTRY}/n8n:staging"]
platforms = ["linux/amd64"]
cache-from = ["type=registry,ref=${REGISTRY}/n8n:cache"]
cache-to = ["type=registry,ref=${REGISTRY}/n8n:cache"]
args = {
NODE_ENV = "production"
}
}
target "production" {
context = "."
dockerfile = "Dockerfile"
tags = ["${REGISTRY}/n8n:production"]
platforms = ["linux/amd64"]
cache-from = ["type=registry,ref=${REGISTRY}/n8n:cache"]
cache-to = ["type=registry,ref=${REGISTRY}/n8n:cache"]
args = {
NODE_ENV = "production"
}
}