Skip to content

Commit

Permalink
docker
Browse files Browse the repository at this point in the history
  • Loading branch information
cn-kali-team committed Feb 11, 2024
1 parent fcd62a2 commit c569b4e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ FROM rust:latest AS server

WORKDIR /prod
#为了命中docker构建缓存,先拷贝这几个文件进去
RUN --mount=type=cache,target=/var/lib/cache/ apt-get update &&\
apt-get install -y --no-install-recommends gcc-multilib xz-utils liblz4-tool libc6-dev libssl-dev default-libmysqlclient-dev pkg-config musl-tools patchelf build-essential zlib1g-dev ca-certificates
COPY .cargo .cargo
COPY nvd-server/Cargo.toml Cargo.toml
COPY nvd-model/ /nvd-model
RUN --mount=type=cache,target=/var/cache/buildkit \
CARGO_HOME=/var/cache/buildkit/cargo \
CARGO_TARGET_DIR=/var/cache/buildkit/target \
cargo fetch
RUN --mount=type=cache,target=/var/lib/cache/ apt-get update \
apt-get install -y --no-install-recommends gcc-multilib xz-utils liblz4-tool libc6-dev libssl-dev default-libmysqlclient-dev pkg-config musl-tools patchelf build-essential zlib1g-dev ca-certificates
COPY nvd-server/src src
RUN --mount=type=cache,target=/var/cache/buildkit \
CARGO_HOME=/var/cache/buildkit/cargo \
Expand Down
5 changes: 2 additions & 3 deletions DockerfileHelper
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ FROM rust:latest AS helper

WORKDIR /prod
#为了命中docker构建缓存,先拷贝这几个文件进去
COPY .cargo .cargo
RUN --mount=type=cache,target=/var/lib/cache/ apt-get update \
RUN --mount=type=cache,target=/var/lib/cache/ apt-get update &&\
apt-get install -y --no-install-recommends gcc-multilib xz-utils liblz4-tool libc6-dev libssl-dev default-libmysqlclient-dev pkg-config musl-tools patchelf build-essential zlib1g-dev ca-certificates
COPY .cargo .cargo
COPY helper/Cargo.toml Cargo.toml
Expand All @@ -23,7 +22,7 @@ RUN --mount=type=cache,target=/var/cache/buildkit \
FROM debian:latest AS runner
WORKDIR /prod
ENV TZ=Asia/Shanghai
RUN --mount=type=cache,target=/var/lib/cache/ apt-get update \
RUN --mount=type=cache,target=/var/lib/cache/ apt-get update &&\
apt-get install -y --no-install-recommends libssl-dev default-libmysqlclient-dev ca-certificates
COPY --from=helper /prod/target/release/helper /prod
ENTRYPOINT [ "/prod/helper" ]

0 comments on commit c569b4e

Please sign in to comment.