Skip to content

Add tools version of containers #122

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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: 3 additions & 0 deletions Dockerfile-tools.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM rust:%%RUST-IMAGE%%

RUN rustup component add rustfmt clippy llvm-tools-preview
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Christiaan676 I think this is now available as llvm-tools directly without the preview

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This indeed seems to be the case. (https://rust-lang.github.io/rustup/concepts/components.html).

This merge request is already more than a year old. I'm willing to update it and change things if needed, but only if a maintainer is wiling to review and eventually merge it. Currently updating it seems to be a wast of my time.

49 changes: 48 additions & 1 deletion x.py
Original file line number Diff line number Diff line change
@@ -66,6 +66,7 @@ def update_debian():

template = read_file("Dockerfile-debian.template")
slim_template = read_file("Dockerfile-slim.template")
tools_template = read_file("Dockerfile-tools.template")

for variant in debian_variants:
rendered = template \
@@ -82,6 +83,10 @@ def update_debian():
.replace("%%ARCH-CASE%%", arch_case)
write_file(f"{rust_version}/{variant}/slim/Dockerfile", rendered)

rendered = tools_template \
.replace("%%RUST-IMAGE%%", f"{rust_version}-{variant}")
write_file(f"{rust_version}/{variant}/tools/Dockerfile", rendered)

def update_alpine():
arch_case = 'apkArch="$(apk --print-arch)"; \\\n'
arch_case += ' case "$apkArch" in \\\n'
@@ -92,6 +97,7 @@ def update_alpine():
arch_case += ' esac'

template = read_file("Dockerfile-alpine.template")
tools_template = read_file("Dockerfile-tools.template")

for version in alpine_versions:
rendered = template \
@@ -101,17 +107,25 @@ def update_alpine():
.replace("%%ARCH-CASE%%", arch_case)
write_file(f"{rust_version}/alpine{version}/Dockerfile", rendered)

rendered = tools_template \
.replace("%%RUST-IMAGE%%", f"{rust_version}-alpine{version}")
write_file(f"{rust_version}/alpine{version}/tools/Dockerfile", rendered)


def update_travis():
file = ".travis.yml"
config = read_file(file)

versions = ""
for variant in debian_variants:
versions += f" - VERSION={rust_version} VARIANT={variant}\n"
versions += f" - VERSION={rust_version} VARIANT={variant}/tools\n"
versions += f" - VERSION={rust_version} VARIANT={variant}/slim\n"

for version in alpine_versions:
versions += f" - VERSION={rust_version} VARIANT=alpine{version}\n"
versions += f" - VERSION={rust_version} VARIANT=alpine{version}/tools\n"
versions += f" - VERSION={rust_version} VARIANT={variant}/slim\n"

marker = "#VERSIONS\n"
split = config.split(marker)
@@ -152,6 +166,7 @@ def generate_stackbrew_library():
"""

for variant in debian_variants:
# Base tags
tags = []
for version_tag in version_tags():
tags.append(f"{version_tag}-{variant}")
@@ -165,7 +180,8 @@ def generate_stackbrew_library():
tags,
map(lambda a: a.bashbrew, debian_arches),
os.path.join(rust_version, variant))


# Slim tags
tags = []
for version_tag in version_tags():
tags.append(f"{version_tag}-slim-{variant}")
@@ -180,7 +196,23 @@ def generate_stackbrew_library():
map(lambda a: a.bashbrew, debian_arches),
os.path.join(rust_version, variant, "slim"))

# Tools tags
tags = []
for version_tag in version_tags():
tags.append(f"{version_tag}-tools-{variant}")
tags.append(f"tools-{variant}")
if variant == default_debian_variant:
for version_tag in version_tags():
tags.append(f"{version_tag}-tools")
tags.append("tools")

library += single_library(
tags,
map(lambda a: a.bashbrew, debian_arches),
os.path.join(rust_version, variant, "tools"))

for version in alpine_versions:
# Base tags
tags = []
for version_tag in version_tags():
tags.append(f"{version_tag}-alpine{version}")
@@ -195,6 +227,21 @@ def generate_stackbrew_library():
map(lambda a: a.bashbrew, alpine_arches),
os.path.join(rust_version, f"alpine{version}"))

# Tools tags
tags = []
for version_tag in version_tags():
tags.append(f"{version_tag}-tools-alpine{version}")
tags.append(f"tools-alpine{version}")
if version == default_alpine_version:
for version_tag in version_tags():
tags.append(f"{version_tag}-tools-alpine")
tags.append("tools-alpine")

library += single_library(
tags,
map(lambda a: a.bashbrew, alpine_arches),
os.path.join(rust_version, f"tools-alpine{version}"))

print(library)

def usage():