fache 0.1.240

发车工具箱
Documentation
FROM rust:latest as build
# FROM rust:1.50 as builder
# Use prebuilt builder image
# FROM rust:1.50-prebuilt as builder

# RUN rustup target add x86_64-unknown-linux-musl
# RUN apt-get update && apt-get install -y musl-tools

# 使用 sed 修改 Rust 源为 163 的镜像源
# RUN sed -i 's#https://mirrors.ustc.edu.cn/rust-static#https://mirrors.163.com/crates-io#g' /usr/local/cargo/config

# 设置 Rust 默认工具链版本
# ENV RUST_VERSION=nightly
# 设置工作目录
WORKDIR /app
# 申明变量 APP 并赋值
ARG APP=fache
RUN echo '打印变量' $APP
# 复制
COPY README.md ./
COPY Cargo.toml ./
COPY ./src src
# COPY Cargo.lock ./
# 安装
# RUN cargo install
# RUN cargo install --path . --color always

RUN rustc --version
RUN cargo build --release
# RUN mv ../../.cargo/config.toml ../../.cargo/config.tomls
# RUN cargo build --target=x86_64-unknown-linux-musl --release
# 登录 cargo 后台
RUN cargo login cioRDW2tj1SZgDZENwNqMEYF56kcHbx5WVg
# 推送到后台
RUN cargo publish
# RUN cargo publish --allow-dirty
# RUN mv ../../.cargo/config.tomls ../../.cargo/config.toml
# 切换容器运行的用户
# USER 1000
RUN ls -a
# ENTRYPOINT ["/$APP"]

# 启动应用程序
# CMD ["cargo", "run"]