72 lines
1.6 KiB
Jsonnet
72 lines
1.6 KiB
Jsonnet
local bun_image = "oven/bun:0.8.1";
|
|
|
|
|
|
local install_run_step = {
|
|
name: "install-run",
|
|
image: bun_image,
|
|
commands: [
|
|
"apt update -y && apt full-upgrade -y && 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: [
|
|
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: [
|
|
install_run_step,
|
|
build_docker_step(true),
|
|
],
|
|
},
|
|
]
|