1 Star 0 Fork 0

宇宙蒙面侠X/axum-grpc-demo

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Dockerfile 1.73 KB
一键复制 编辑 原始数据 按行查看 历史
FROM ekidd/rust-musl-builder:1.48.0 as cargo-build
USER root
RUN rustup default stable
RUN rustup target add x86_64-unknown-linux-musl
RUN sed -i "s@http://\(deb\|security\).debian.org@https://mirrors.aliyun.com@g" /etc/apt/sources.list
RUN apt-get clean
RUN apt-get update
RUN apt-get install -y protobuf-compiler
RUN apt-get install -y musl musl-dev musl-tools
RUN mkdir -p /root/.cargo
COPY docker/.cargo/config /root/.cargo/
RUN export CARGO_HTTP_DEBUG=true
RUN export CARGO_LOG=cargo::ops::registry=debug
RUN mkdir -p /home/axum-grpc-demo
RUN mkdir -p /home/axum-grpc-demo/.cargo
COPY docker/.cargo/config /home/axum-grpc-demo/.cargo/
WORKDIR /home/axum-grpc-demo
COPY Cargo.toml Cargo.toml
RUN mkdir src/
RUN echo "fn main() {println!(\"if you see this, the build broke\")}" > src/main.rs
RUN RUSTFLAGS=-Clinker=musl-gcc cargo build -v --release --target=x86_64-unknown-linux-musl
RUN rm -f target/x86_64-unknown-linux-musl/release/deps/axum-grpc-demo*
COPY proto /home/axum-grpc-demo/proto
COPY src /home/axum-grpc-demo/src
COPY build.rs /home/axum-grpc-demo/
RUN RUSTFLAGS=-Clinker=musl-gcc cargo build -v --release --target=x86_64-unknown-linux-musl
FROM alpine:latest
USER root
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
RUN mkdir -p /home/myapp/bin/
WORKDIR /home/myapp/bin/
COPY --from=cargo-build /home/axum-grpc-demo/target/x86_64-unknown-linux-musl/release/axum-grpc-demo .
RUN addgroup -g 1000 myapp
RUN adduser -D -s /bin/sh -u 1000 -G myapp myapp
RUN chown myapp:myapp axum-grpc-demo
RUN chgrp -R myapp /tmp
RUN chmod -R g+w /tmp
#时区设置上海
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo "Asia/Shanghai" > /etc/timezone
USER myapp
EXPOSE 8080
ENTRYPOINT ./axum-grpc-demo
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/awol2010ex/axum-grpc-demo.git
git@gitee.com:awol2010ex/axum-grpc-demo.git
awol2010ex
axum-grpc-demo
axum-grpc-demo
master

搜索帮助