Files
drone-better-docker-autotag/.drone.jsonnet
Julien Valverdé 93264ad1e2
All checks were successful
continuous-integration/drone/pr Build is passing
Upgrade to Bun 1.0
2023-09-10 01:16:31 +02:00

80 lines
1.9 KiB
Jsonnet

local bun_image = "oven/bun:1.0";
local fetch_step = {
name: "fetch",
image: "alpine/git",
commands: ["git fetch --tags"],
};
local generate_docker_tags_step = {
name: "generate-docker-tags",
image: bun_image,
commands: [
"apt-get update && apt-get install -y --reinstall --no-install-recommends ca-certificates && apt-get install -y --no-install-recommends git",
"bun install --frozen-lockfile --no-cache --production",
"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,
generate_docker_tags_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,
generate_docker_tags_step,
build_docker_step(true),
],
},
]