-
Notifications
You must be signed in to change notification settings - Fork 212
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Combine the compiler Dockerfiles and use the Docker registry
- Loading branch information
1 parent
6debe11
commit 0083434
Showing
7 changed files
with
61 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,62 @@ | ||
#!/bin/bash | ||
|
||
set -eu -o pipefail | ||
set -euv -o pipefail | ||
|
||
cd base | ||
docker build -t 'rust-base' . | ||
cd .. | ||
channels_to_build="${CHANNELS_TO_BUILD-stable beta nightly}" | ||
tools_to_build="${TOOLS_TO_BUILD-rustfmt clippy}" | ||
perform_push="${PERFORM_PUSH-false}" | ||
|
||
date_url_base=https://static.rust-lang.org/dist | ||
repository=shepmaster | ||
|
||
for channel in stable beta nightly; do | ||
filename="channel-rust-${channel}-date.txt" | ||
date_url_base=https://static.rust-lang.org/dist | ||
|
||
cd "$channel" | ||
for channel in $channels_to_build; do | ||
cd "base" | ||
|
||
filename="channel-rust-${channel}-date.txt" | ||
curl -o "${filename}" "${date_url_base}/${filename}" | ||
date=$(cat "${filename}") | ||
|
||
docker build -t "rust-${channel}" --build-arg date="${date}" . | ||
image_name="rust-${channel}" | ||
full_name="${repository}/${image_name}" | ||
|
||
docker pull "${full_name}" | ||
docker build -t "${full_name}" \ | ||
--cache-from "${full_name}" \ | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
shepmaster
Author
Member
|
||
--build-arg channel="${channel}" \ | ||
--build-arg date="${date}" \ | ||
. | ||
docker tag "${full_name}" "${image_name}" | ||
|
||
if [[ "${perform_push}" == 'true' ]]; then | ||
docker push "${full_name}" | ||
fi | ||
|
||
cd .. | ||
done | ||
|
||
crate_api_base=https://crates.io/api/v1/crates | ||
|
||
for tool in rustfmt clippy; do | ||
filename="version-${tool}.txt" | ||
|
||
for tool in $tools_to_build; do | ||
cd "${tool}" | ||
|
||
filename="version-${tool}.txt" | ||
curl -o "${filename}" "${crate_api_base}/${tool}" | ||
version=$(jq -r '.crate.max_version' "${filename}") | ||
|
||
docker build -t "${tool}" --build-arg version="${version}" . | ||
image_name="${tool}" | ||
full_name="${repository}/${image_name}" | ||
|
||
docker pull "${full_name}" | ||
docker build -t "${full_name}" \ | ||
--cache-from "${full_name}" \ | ||
--build-arg version="${version}" \ | ||
. | ||
docker tag "${full_name}" "${image_name}" | ||
|
||
if [[ "${perform_push}" == 'true' ]]; then | ||
docker push "${full_name}" | ||
fi | ||
|
||
cd .. | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FROM rust-nightly | ||
FROM shepmaster/rust-nightly | ||
|
||
ARG version | ||
|
||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FROM rust-stable | ||
FROM shepmaster/rust-stable | ||
|
||
ARG version | ||
|
||
|
This file was deleted.
Oops, something went wrong.
FYI,
--cache-from
is new in docker 1.13 (moby/moby#26839), so this flag breaks the build in a stock AMI environment, which currently has only docker 1.12.