Files
hemhub/.drone.yml
Urban Modig cfbdd3bfdb
Some checks failed
continuous-integration/drone/push Build is failing
Refactor Drone CI and Dockerfile for optimized builds and runtime
Streamlined `.drone.yml` by removing redundant test-and-jar step, introducing image caching with `cache_from`, and refining conditional triggers. Enhanced `Dockerfile` with multi-stage builds for dependency warming, test execution, and efficient package creation, alongside runtime optimizations for graceful shutdown and resource management.
2025-10-08 16:41:47 +02:00

66 lines
1.7 KiB
YAML

kind: pipeline
type: docker
name: ci
environment:
DOCKER_BUILDKIT: 1
steps:
- name: build-image
image: plugins/docker
settings:
registry: rubble.se:5000
repo: rubble.se:5000/hemhub/api
dockerfile: Dockerfile
username:
from_secret: docker_username
password:
from_secret: docker_password
tags:
- ${DRONE_BRANCH/\//-}-${DRONE_COMMIT_SHA:0:7}
- latest
buildkit: true
# ⬇️ Pull last image and reuse its layers (huge win)
cache_from:
- rubble.se:5000/hemhub/api:latest
labels:
org.opencontainers.image.source: ${DRONE_GIT_HTTP_URL}
org.opencontainers.image.revision: ${DRONE_COMMIT_SHA}
org.opencontainers.image.created: ${DRONE_BUILD_FINISHED}
org.opencontainers.image.version: ${DRONE_TAG:-${DRONE_COMMIT_SHA:0:7}}
when:
branch:
include: [ main, develop ]
event:
include: [ push, pull_request, tag ]
- name: publish-tag
image: plugins/docker
settings:
registry: rubble.se:5000
repo: rubble.se:5000/hemhub/api
dockerfile: Dockerfile
username:
from_secret: docker_username
password:
from_secret: docker_password
tags:
- ${DRONE_TAG}
buildkit: true
cache_from:
- rubble.se:5000/hemhub/api:latest
labels:
org.opencontainers.image.source: ${DRONE_GIT_HTTP_URL}
org.opencontainers.image.revision: ${DRONE_COMMIT_SHA}
org.opencontainers.image.created: ${DRONE_BUILD_FINISHED}
org.opencontainers.image.version: ${DRONE_TAG}
when:
event:
include: [ tag ]
trigger:
event:
- push
- pull_request
- tag