Skip to content

Commit 48c010f

Browse files
2403772980ygyErinaInittaoky
authored
添加 rustup image (#138)
* Added a basic version of rustup-mirror * updated README.md, updated parameter names * Apply suggestions from code review Edited README.md Co-authored-by: taoky <[email protected]> * removed git submodules for rustup * Updated Dockerfile and sync.sh for rustup * Added upstream project description for rustup, fixed punctuations. * Added exec in sync.sh * Added Maintainer label * Fixed tabulation for sync.sh --------- Co-authored-by: Erina Init <[email protected]> Co-authored-by: taoky <[email protected]>
1 parent f4f5860 commit 48c010f

File tree

3 files changed

+58
-0
lines changed

3 files changed

+58
-0
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
- [rclone](#rclone)
3737
- [rsync](#rsync)
3838
- [rubygems](#rubygems)
39+
- [rustup](#rustup)
3940
- [stackage](#stackage)
4041
- [tsumugu](#tsumugu)
4142
- [winget-source](#winget-source)
@@ -430,6 +431,21 @@ ref:
430431
| ---------- | ---------------------------------- |
431432
| `UPSTREAM` | Defaults to `http://rubygems.org`. |
432433

434+
### rustup
435+
436+
[![rustup](https://img.shields.io/docker/image-size/ustcmirror/rustup/latest)](https://hub.docker.com/r/ustcmirror/rustup "rustup")
437+
[![rustup](https://img.shields.io/docker/pulls/ustcmirror/rustup/latest)](https://hub.docker.com/r/ustcmirror/rustup "rustup")
438+
439+
This image is based on [rustup-mirror](https://github.com/jiegec/rustup-mirror).
440+
441+
| Parameter | Description |
442+
| ---------- | ------------------------------------------- |
443+
| `UPSTREAM` | Defaults to `https://static.rust-lang.org/` |
444+
| `GC` | Defaults to `1` |
445+
| `TARGETS` | Defaults to `x86_64-unknown-linux-gnu` |
446+
| `URL` | Defaults to `http://127.0.0.1:8000/` |
447+
448+
433449
### shadowmire
434450

435451
[![shadowmire](https://img.shields.io/docker/image-size/ustcmirror/shadowmire/latest)](https://hub.docker.com/r/ustcmirror/shadowmire "shadowmire")

rustup/Dockerfile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
FROM rust:latest AS builder
2+
3+
RUN apt update \
4+
&& apt install -y --no-install-recommends git
5+
6+
RUN git clone https://github.com/jiegec/rustup-mirror app && \
7+
cd app && \
8+
git checkout v0.9.0
9+
10+
WORKDIR /app
11+
12+
ARG CARGO_BUILD_EXTRA=" "
13+
RUN cargo build --release ${CARGO_BUILD_EXTRA}
14+
15+
FROM ustcmirror/base:debian
16+
LABEL maintainer="Erina Init <[email protected]>"
17+
18+
COPY --from=builder /app/target/release/rustup-mirror /usr/local/bin
19+
20+
RUN apt update \
21+
&& apt install -y \
22+
ca-certificates \
23+
libssl3
24+
25+
ADD sync.sh /

rustup/sync.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
3+
set -eu
4+
[[ $DEBUG = true ]] && set -x
5+
6+
echo "Running script"
7+
8+
export UPSTREAM="${UPSTREAM:-https://static.rust-lang.org/}"
9+
export GC="${GC:-1}"
10+
export TARGETS="${TARGETS:-x86_64-unknown-linux-gnu}"
11+
export URL="${URL:-http://127.0.0.1:8000.}"
12+
13+
exec rustup-mirror --upstream-url "$UPSTREAM" \
14+
--targets "$TARGETS" \
15+
--gc "$GC" \
16+
--url "$URL" \
17+
--mirror "$TO"

0 commit comments

Comments
 (0)