< 返回版块

Dalei 发表于 2018-03-30 14:02

Tags:docker,rocket

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-30 18:35

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

1 共 1 条评论, 1 页