2024-09-23 15:50:55 +08:00
|
|
|
|
# 以 node:16-bullseye 镜像为基础,添加openssl、libssl-dev、musl-tools、Rust 工具链等工具
|
2024-09-23 15:06:33 +08:00
|
|
|
|
# 用于构建 Rust 项目的镜像
|
|
|
|
|
FROM node:16-bullseye
|
|
|
|
|
|
2024-09-23 16:15:51 +08:00
|
|
|
|
# 更换apt源为国内阿里云镜像
|
|
|
|
|
RUN sed -i 's|http://deb.debian.org/debian|http://mirrors.aliyun.com/debian|g' /etc/apt/sources.list && \
|
|
|
|
|
sed -i 's|http://deb.debian.org/debian-security|http://mirrors.aliyun.com/debian-security|g' /etc/apt/sources.list && \
|
2024-09-23 16:24:37 +08:00
|
|
|
|
apt-get update && apt-get install -y openssl libssl-dev musl-tools
|
2024-09-23 16:30:57 +08:00
|
|
|
|
|
|
|
|
|
# 设置 RUSTUP_DIST_SERVER 和 RUSTUP_UPDATE_ROOT 环境变量
|
|
|
|
|
ENV RUSTUP_DIST_SERVER=https://rsproxy.cn
|
|
|
|
|
ENV RUSTUP_UPDATE_ROOT=https://rsproxy.cn/rustup
|
|
|
|
|
# 安装 Rust 工具链
|
|
|
|
|
RUN curl --proto '=https' --tlsv1.2 -sSf https://rsproxy.cn/rustup-init.sh | sh -s -- -y
|
2024-09-23 15:06:33 +08:00
|
|
|
|
ENV PATH="/root/.cargo/bin:${PATH}"
|
|
|
|
|
RUN rustup target add x86_64-unknown-linux-musl
|
|
|
|
|
|
2024-09-23 15:50:55 +08:00
|
|
|
|
CMD [ "node" ]
|