< 返回版块

分享一下Rocket项目的Dockerfile

Dalei 发表于

标签:docker,rocket 浏览:135 评论:1

FROM rustlang/rust:nightly as build

RUN USER=root cargo new --bin app
WORKDIR /app

COPY ./Cargo.lock ./Cargo.lock
COPY ./Cargo.toml ./Cargo.toml
COPY ./config .cargo/

RUN cargo build --release
RUN rm -rf src && rm -rf target

COPY ./src ./src

RUN cargo build --release


FROM debian:jessie-slim

ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en

RUN mkdir -p /data/logs && chmod 0755 /data/logs

WORKDIR /data/src

COPY --from=build /app/target/release/app .
COPY Rocket.toml .

EXPOSE 8080

CMD ["./app"]

评论区

fishfish 2018-03-30T10:35:14.844023

nightly 的只能自己玩,不能拿到生产环境中去用啊

1 共 1 评论, 共 1 页