Skip to content
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

Add a library file for Rust #3273

Merged
merged 4 commits into from
Aug 10, 2017
Merged

Add a library file for Rust #3273

merged 4 commits into from
Aug 10, 2017

Conversation

sfackler
Copy link
Contributor

@sfackler sfackler commented Aug 5, 2017

The repo is under my account but I'll poke people about migrating it to one of the rust-lang orgs (or docker-library?) once this is ready to land.

It's only configured to build Debian images right now. There isn't yet a build of the compiler targeting MUSL libc, so Alpine images will have to wait for that. On the Windows side, the Visual C++ build tools are required. There's a headless installer for those, but it seems like nanoserver is missing some of the DLLs required to run it, unfortunately.

docker-library/docs update is over here: https://github.com/sfackler/docs/tree/rust

Checklist for Review

NOTE: This checklist is intended for the use of the Official Images maintainers both to track the status of your PR and to help inform you and others of where we're at. As such, please leave the "checking" of items to the repository maintainers. If there is a point below for which you would like to provide additional information or note completion, please do so by commenting on the PR. Thanks! (and thanks for staying patient with us ❤️)

  • associated with or contacted upstream?
  • does it fit into one of the common categories? ("service", "language stack", "base distribution")
    • language stack
  • is it reasonably popular, or does it solve a particular use case well?
  • does a documentation PR exist? (should be reviewed and merged at roughly the same time so that we don't have an empty image page on the Hub for very long)
  • dockerization review for best practices and cache gotchas/improvements (ala the official review guidelines)?
  • 2+ dockerization review?
  • existing official images have been considered as a base? (ie, if foobar needs Node.js, has FROM node:... instead of grabbing node via other means been considered?)
  • if FROM scratch, tarballs only exist in a single commit within the associated history?
  • passes current tests? any simple new tests that might be appropriate to add? (https://github.com/docker-library/official-images/tree/master/test)

@tianon
Copy link
Member

tianon commented Aug 7, 2017

Nice! I've been taking a look, and the only thing I can see to comment on WRT the Dockerization is whether or not FROM buildpack-deps:SUITE is appropriate (or whether one of FROM buildpack-deps:SUITE-scm or FROM buildpack-deps:SUITE-curl might be better) -- we usually only use the full SUITE version when it's common to build against C headers/libraries (for example, Python packages and Ruby gems), but go for something lighter when it's less common (such as in Go or OpenJDK). We also usually then provide a slim variant (for example, python:3-slim) which is from a smaller base, since buildpack-deps:SUITE tends to be enormous. In this case, I think the size probably doesn't matter, since like golang and gcc, you're more likely to move your compiled binaries elsewhere (either via multi-stage builds or other methods), but possibly still something to consider.

If you can convince other Rust folks that this repo can live under the Rust org, that'd be ideal (and makes the upstream ties extremely clear), but it's definitely not required for acceptance. 👍

@sfackler
Copy link
Contributor Author

sfackler commented Aug 7, 2017

Linking to C libraries is relatively common in Rust code (OpenSSL in particular from the list of things installed by the image), so I went with buildpack-deps:SUITE. I do think the rust images mirror golang and gcc best with respect to usage patterns, but I'll defer to your judgement on whether we should have a slim image - it should be pretty easy to add if there's interest.

I'll talk to people about getting the repo moved!

@sfackler
Copy link
Contributor Author

sfackler commented Aug 7, 2017

Repo has been transferred over to https://github.com/rust-lang-nursery/docker-rust. rust-lang-nursery is an "official" org managed by the Rust team just like rust-lang is, but things tend to move to the nursery first.

@nrc
Copy link

nrc commented Aug 7, 2017

Hi, I'm the Rust dev tools team lead, just checking in to say we approve of this :-) We do consider the nursery an official repo - it hosts a lot of our key projects before they are considered stable. Please feel free to ping me if I can help with anything.

@sfackler
Copy link
Contributor Author

sfackler commented Aug 9, 2017

Fixed up the library file to (correctly) point to the new repo.

@yosifkit
Copy link
Member

Diff:
error: failed fetching repo "rust"
unable to find a manifest named "rust" (in "/tmp/tmp.4XMHZw6WCv/oi/library" or as a remote URL)
error: failed fetching repo "rust"
unable to find a manifest named "rust" (in "/tmp/tmp.4XMHZw6WCv/oi/library" or as a remote URL)
error: failed fetching repo "rust"
unable to find a manifest named "rust" (in "/tmp/tmp.4XMHZw6WCv/oi/library" or as a remote URL)
error: failed fetching repo "rust"
unable to find a manifest named "rust" (in "/tmp/tmp.4XMHZw6WCv/oi/library" or as a remote URL)
diff --git a/_bashbrew-arches b/_bashbrew-arches
index e69de29..eaae61f 100644
--- a/_bashbrew-arches
+++ b/_bashbrew-arches
@@ -0,0 +1,10 @@
+rust:jessie @ amd64
+rust:jessie @ arm32v7
+rust:jessie @ i386
+rust:jessie @ ppc64le
+rust:jessie @ s390x
+rust:latest @ amd64
+rust:latest @ arm32v7
+rust:latest @ i386
+rust:latest @ ppc64le
+rust:latest @ s390x
diff --git a/_bashbrew-list b/_bashbrew-list
index e69de29..c33d7fd 100644
--- a/_bashbrew-list
+++ b/_bashbrew-list
@@ -0,0 +1,12 @@
+rust:1
+rust:1-jessie
+rust:1-stretch
+rust:1.19
+rust:1.19-jessie
+rust:1.19-stretch
+rust:1.19.0
+rust:1.19.0-jessie
+rust:1.19.0-stretch
+rust:jessie
+rust:latest
+rust:stretch
diff --git a/rust_jessie/Dockerfile b/rust_jessie/Dockerfile
new file mode 100644
index 0000000..4e6b640
--- /dev/null
+++ b/rust_jessie/Dockerfile
@@ -0,0 +1,29 @@
+FROM buildpack-deps:jessie
+
+ENV RUSTUP_HOME=/usr/local/rustup \
+    CARGO_HOME=/usr/local/cargo \
+    PATH=/usr/local/cargo/bin:$PATH
+
+RUN set -eux; \
+    \
+# this "case" statement is generated via "update.sh"
+    dpkgArch="$(dpkg --print-architecture)"; \
+	case "${dpkgArch##*-}" in \
+		amd64) rustArch='x86_64-unknown-linux-gnu'; rustupSha256='7b5ce33a881992b285e2aa6cbc785da4138c5bab7c8c9b55c06918bfb1ba0efa' ;; \
+		armhf) rustArch='armv7-unknown-linux-gnueabihf'; rustupSha256='a92b003a15b2e4bd240c0f1d46232958c173f5605814e19961fc8a4d99a25b3e' ;; \
+		i386) rustArch='i686-unknown-linux-gnu'; rustupSha256='4a478c977b7b4900456c2d4dd165019e7c923ebdaba3f47316717d1690387d9a' ;; \
+		ppc64el) rustArch='powerpc64le-unknown-linux-gnu'; rustupSha256='5a966b6dd113995ff2e9cb59e9fd36aa2ce378bb1a397f27ceaeb41df5cf34c8' ;; \
+		s390x) rustArch='s390x-unknown-linux-gnu'; rustupSha256='e89be1ac02188cbe181c00725a036f814817be337a6480cdcc83b3fa98acb875' ;; \
+		*) echo >&2 "unsupported architecture: ${dpkgArch}"; exit 1 ;; \
+	esac; \
+    \
+    url="https://static.rust-lang.org/rustup/archive/1.5.0/${rustArch}/rustup-init"; \
+    wget "$url"; \
+    echo "${rustupSha256} *rustup-init" | sha256sum -c -; \
+    chmod +x rustup-init; \
+    ./rustup-init -y --no-modify-path --default-toolchain 1.19.0; \
+    rm rustup-init; \
+    chmod -R a+w $RUSTUP_HOME $CARGO_HOME; \
+    rustup --version; \
+    cargo --version; \
+    rustc --version;
diff --git a/rust_latest/Dockerfile b/rust_latest/Dockerfile
new file mode 100644
index 0000000..8917ac2
--- /dev/null
+++ b/rust_latest/Dockerfile
@@ -0,0 +1,29 @@
+FROM buildpack-deps:stretch
+
+ENV RUSTUP_HOME=/usr/local/rustup \
+    CARGO_HOME=/usr/local/cargo \
+    PATH=/usr/local/cargo/bin:$PATH
+
+RUN set -eux; \
+    \
+# this "case" statement is generated via "update.sh"
+    dpkgArch="$(dpkg --print-architecture)"; \
+	case "${dpkgArch##*-}" in \
+		amd64) rustArch='x86_64-unknown-linux-gnu'; rustupSha256='7b5ce33a881992b285e2aa6cbc785da4138c5bab7c8c9b55c06918bfb1ba0efa' ;; \
+		armhf) rustArch='armv7-unknown-linux-gnueabihf'; rustupSha256='a92b003a15b2e4bd240c0f1d46232958c173f5605814e19961fc8a4d99a25b3e' ;; \
+		i386) rustArch='i686-unknown-linux-gnu'; rustupSha256='4a478c977b7b4900456c2d4dd165019e7c923ebdaba3f47316717d1690387d9a' ;; \
+		ppc64el) rustArch='powerpc64le-unknown-linux-gnu'; rustupSha256='5a966b6dd113995ff2e9cb59e9fd36aa2ce378bb1a397f27ceaeb41df5cf34c8' ;; \
+		s390x) rustArch='s390x-unknown-linux-gnu'; rustupSha256='e89be1ac02188cbe181c00725a036f814817be337a6480cdcc83b3fa98acb875' ;; \
+		*) echo >&2 "unsupported architecture: ${dpkgArch}"; exit 1 ;; \
+	esac; \
+    \
+    url="https://static.rust-lang.org/rustup/archive/1.5.0/${rustArch}/rustup-init"; \
+    wget "$url"; \
+    echo "${rustupSha256} *rustup-init" | sha256sum -c -; \
+    chmod +x rustup-init; \
+    ./rustup-init -y --no-modify-path --default-toolchain 1.19.0; \
+    rm rustup-init; \
+    chmod -R a+w $RUSTUP_HOME $CARGO_HOME; \
+    rustup --version; \
+    cargo --version; \
+    rustc --version;

Copy link
Member

@yosifkit yosifkit left a comment

Choose a reason for hiding this comment

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

Build test of #3273; 70c74ca (rust):

$ bashbrew build rust:1.19.0-stretch
Building bashbrew/cache:41518f562d8ffeb09a83afc5eed7fb6e9576161f845d5af466cb4a4f7bc54bd5 (rust:1.19.0-stretch)
Tagging rust:1.19.0-stretch
Tagging rust:1-stretch
Tagging rust:1.19-stretch
Tagging rust:stretch
Tagging rust:1.19.0
Tagging rust:1
Tagging rust:1.19
Tagging rust:latest

$ test/run.sh rust:1.19.0-stretch
testing rust:1.19.0-stretch
	'utc' [1/5]...passed
	'cve-2014--shellshock' [2/5]...passed
	'no-hard-coded-passwords' [3/5]...passed
	'override-cmd' [4/5]...passed
	'rust-hello-world' [5/5]...passed


$ bashbrew build rust:1.19.0-jessie
Building bashbrew/cache:cbb25dcfc6de43b333e550b0b5ba315fb94e89d93d0d399584330bc3494107f8 (rust:1.19.0-jessie)
Tagging rust:1.19.0-jessie
Tagging rust:1-jessie
Tagging rust:1.19-jessie
Tagging rust:jessie

$ test/run.sh rust:1.19.0-jessie
testing rust:1.19.0-jessie
	'utc' [1/5]...passed
	'cve-2014--shellshock' [2/5]...passed
	'no-hard-coded-passwords' [3/5]...passed
	'override-cmd' [4/5]...passed
	'rust-hello-world' [5/5]...passed

@tianon tianon merged commit 6b34605 into docker-library:master Aug 10, 2017
@sfackler sfackler deleted the rust branch August 10, 2017 21:47
@tianon
Copy link
Member

tianon commented Aug 10, 2017

Looks like s390x and ppc64le are failing to build for different reasons:

+ ./rustup-init -y --no-modify-path --default-toolchain 1.19.0
rustup-init: OK
thread 'main' panicked at 'host triple couldn't be converted to partial triple', /checkout/src/libcore/option.rs:794
note: Run with `RUST_BACKTRACE=1` for a backtrace.
Removing intermediate container ae7b856100c4
The command '/bin/sh -c set -eux;         dpkgArch="$(dpkg --print-architecture)"; 	case "${dpkgArch##*-}" in 		amd64) rustArch='x86_64-unknown-linux-gnu'; rustupSha256='7b5ce33a881992b285e2aa6cbc785da4138c5bab7c8c9b55c06918bfb1ba0efa' ;; 		armhf) rustArch='armv7-unknown-linux-gnueabihf'; rustupSha256='a92b003a15b2e4bd240c0f1d46232958c173f5605814e19961fc8a4d99a25b3e' ;; 		i386) rustArch='i686-unknown-linux-gnu'; rustupSha256='4a478c977b7b4900456c2d4dd165019e7c923ebdaba3f47316717d1690387d9a' ;; 		ppc64el) rustArch='powerpc64le-unknown-linux-gnu'; rustupSha256='5a966b6dd113995ff2e9cb59e9fd36aa2ce378bb1a397f27ceaeb41df5cf34c8' ;; 		s390x) rustArch='s390x-unknown-linux-gnu'; rustupSha256='e89be1ac02188cbe181c00725a036f814817be337a6480cdcc83b3fa98acb875' ;; 		*) echo >&2 "unsupported architecture: ${dpkgArch}"; exit 1 ;; 	esac;         url="https://static.rust-lang.org/rustup/archive/1.5.0/${rustArch}/rustup-init";     wget "$url";     echo "${rustupSha256} *rustup-init" | sha256sum -c -;     chmod +x rustup-init;     ./rustup-init -y --no-modify-path --default-toolchain 1.19.0;     rm rustup-init;     chmod -R a+w $RUSTUP_HOME $CARGO_HOME;     rustup --version;     cargo --version;     rustc --version;' returned a non-zero code: 101
+ rm rustup-init
+ chmod -R a+w /usr/local/rustup /usr/local/cargo
+ rustup --version
Segmentation fault (core dumped)
Removing intermediate container 71e9a2fd67f8
The command '/bin/sh -c set -eux;         dpkgArch="$(dpkg --print-architecture)"; 	case "${dpkgArch##*-}" in 		amd64) rustArch='x86_64-unknown-linux-gnu'; rustupSha256='7b5ce33a881992b285e2aa6cbc785da4138c5bab7c8c9b55c06918bfb1ba0efa' ;; 		armhf) rustArch='armv7-unknown-linux-gnueabihf'; rustupSha256='a92b003a15b2e4bd240c0f1d46232958c173f5605814e19961fc8a4d99a25b3e' ;; 		i386) rustArch='i686-unknown-linux-gnu'; rustupSha256='4a478c977b7b4900456c2d4dd165019e7c923ebdaba3f47316717d1690387d9a' ;; 		ppc64el) rustArch='powerpc64le-unknown-linux-gnu'; rustupSha256='5a966b6dd113995ff2e9cb59e9fd36aa2ce378bb1a397f27ceaeb41df5cf34c8' ;; 		s390x) rustArch='s390x-unknown-linux-gnu'; rustupSha256='e89be1ac02188cbe181c00725a036f814817be337a6480cdcc83b3fa98acb875' ;; 		*) echo >&2 "unsupported architecture: ${dpkgArch}"; exit 1 ;; 	esac;         url="https://static.rust-lang.org/rustup/archive/1.5.0/${rustArch}/rustup-init";     wget "$url";     echo "${rustupSha256} *rustup-init" | sha256sum -c -;     chmod +x rustup-init;     ./rustup-init -y --no-modify-path --default-toolchain 1.19.0;     rm rustup-init;     chmod -R a+w $RUSTUP_HOME $CARGO_HOME;     rustup --version;     cargo --version;     rustc --version;' returned a non-zero code: 139

@sfackler
Copy link
Contributor Author

I'll look into those, thanks.

@sfackler
Copy link
Contributor Author

The 390x failure looks like a bug in the rustup binary, should be pretty simple to fix: rust-lang/rustup#1226

The ppc64le failure will require a bit more digging - rustup-init and rustup are the same executable, so it's a bit strange that it'd work when installing everything but not when running --version: rust-lang/rustup#1227.

blankenshipz added a commit to blankenshipz/docker-rust-example that referenced this pull request Aug 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants