Files
drone-better-docker-autotag/.drone.jsonnet
Julien Valverdé 2a09ad800d
All checks were successful
continuous-integration/drone/push Build is passing
Fetch step
2023-09-01 02:29:53 +02:00

80 lines
1.8 KiB
Jsonnet

local bun_image = "oven/bun:0.8.1";
local fetch_step = {
name: "fetch",
image: "alpine/git",
commands: ["git fetch --tags"],
};
local install_run_step = {
name: "install-run",
image: bun_image,
commands: [
"apt update -y && apt full-upgrade -y && apt install -y --reinstall ca-certificates && apt install -y --no-install-recommends git",
"bun install --production --frozen-lockfile --no-cache",
"bun start .",
],
};
local build_docker_step(publish) = {
name: "build-" + (if publish then "publish-" else "") + "docker",
image: "plugins/docker",
settings: {
dry_run: !publish,
registry: "git.jvalver.de",
username: { from_secret: "docker_username" },
password: { from_secret: "docker_password" },
repo: "git.jvalver.de/thilawyn/drone-better-docker-autotag",
dockerfile: "Dockerfile",
context: ".",
compress: true,
platform: "linux/amd64",
},
};
[
// Build docker images without publishing them for pull requests
{
kind: "pipeline",
type: "docker",
name: "build-docker",
trigger: {
ref: {
include: ["refs/pull/**"]
}
},
steps: [
fetch_step,
install_run_step,
build_docker_step(false),
],
},
// Build docker images and publish them for master and tags
{
kind: "pipeline",
type: "docker",
name: "build-publish-docker",
trigger: {
ref: {
include: [
"refs/heads/master",
"refs/tags/**",
]
}
},
steps: [
fetch_step,
install_run_step,
build_docker_step(true),
],
},
]