Skip to content

add docker image release for Ubuntu based image #5688

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion ci/release-image/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# syntax=docker/dockerfile:experimental

ARG BASE=debian:11
FROM scratch AS packages
COPY release-packages/code-server*.deb /tmp/

FROM debian:11
FROM $BASE

RUN apt-get update \
&& apt-get install -y \
Expand Down
62 changes: 54 additions & 8 deletions ci/release-image/docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,63 @@ variable "VERSION" {
default = "latest"
}

variable "DOCKER_REGISTRY" {
default = "docker.io/codercom/code-server"
}

variable "GITHUB_REGISTRY" {
default = "ghcr.io/coder/code-server"
}

group "default" {
targets = ["code-server"]
targets = [
"code-server-debian-11",
"code-server-ubuntu-focal",
]
}

function "prepend_hyphen_if_not_null" {
params = [tag]
result = notequal("","${tag}") ? "-${tag}" : "${tag}"
}

# use empty tag (tag="") to generate default tags
function "gen_tags" {
params = [registry, tag]
result = notequal("","${registry}") ? [
notequal("", "${tag}") ? "${registry}:${tag}" : "${registry}:latest",
notequal("latest",VERSION) ? "${registry}:${VERSION}${prepend_hyphen_if_not_null(tag)}" : "",
] : []
}

# helper function to generate tags for docker registry and github registry.
# set (DOCKER|GITHUB)_REGISTRY="" to disable corresponding registry
function "gen_tags_for_docker_and_ghcr" {
params = [tag]
result = concat(
gen_tags("${DOCKER_REGISTRY}", "${tag}"),
gen_tags("${GITHUB_REGISTRY}", "${tag}"),
)
}

target "code-server" {
target "code-server-debian-11" {
dockerfile = "ci/release-image/Dockerfile"
tags = [
"docker.io/codercom/code-server:latest",
notequal("latest",VERSION) ? "docker.io/codercom/code-server:${VERSION}" : "",
"ghcr.io/coder/code-server:latest",
notequal("latest",VERSION) ? "ghcr.io/coder/code-server:${VERSION}" : "",
]
tags = concat(
gen_tags_for_docker_and_ghcr(""),
gen_tags_for_docker_and_ghcr("debian"),
gen_tags_for_docker_and_ghcr("bullseye"),
)
platforms = ["linux/amd64", "linux/arm64"]
}

target "code-server-ubuntu-focal" {
dockerfile = "ci/release-image/Dockerfile"
tags = concat(
gen_tags_for_docker_and_ghcr("ubuntu"),
gen_tags_for_docker_and_ghcr("focal"),
)
args = {
BASE = "ubuntu:focal"
}
platforms = ["linux/amd64", "linux/arm64"]
}