feat: add docker image release for Ubuntu based image (#5688)

This commit is contained in:
Wei HU 2022-10-24 14:41:19 -04:00 committed by GitHub
parent 031e903979
commit bbf18cc6b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 57 additions and 10 deletions

View File

@ -1,9 +1,10 @@
# syntax=docker/dockerfile:experimental # syntax=docker/dockerfile:experimental
ARG BASE=debian:11
FROM scratch AS packages FROM scratch AS packages
COPY release-packages/code-server*.deb /tmp/ COPY release-packages/code-server*.deb /tmp/
FROM debian:11 FROM $BASE
RUN apt-get update \ RUN apt-get update \
&& apt-get install -y \ && apt-get install -y \

View File

@ -6,17 +6,63 @@ variable "VERSION" {
default = "latest" default = "latest"
} }
group "default" { variable "DOCKER_REGISTRY" {
targets = ["code-server"] default = "docker.io/codercom/code-server"
} }
target "code-server" { variable "GITHUB_REGISTRY" {
dockerfile = "ci/release-image/Dockerfile" default = "ghcr.io/coder/code-server"
tags = [ }
"docker.io/codercom/code-server:latest",
notequal("latest",VERSION) ? "docker.io/codercom/code-server:${VERSION}" : "", group "default" {
"ghcr.io/coder/code-server:latest", targets = [
notequal("latest",VERSION) ? "ghcr.io/coder/code-server:${VERSION}" : "", "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-debian-11" {
dockerfile = "ci/release-image/Dockerfile"
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"] platforms = ["linux/amd64", "linux/arm64"]
} }