From b9dde911ff14c52cf902adef4a143c7ff550f8ef Mon Sep 17 00:00:00 2001 From: biezhihua Date: Sat, 10 Feb 2024 20:04:50 +0800 Subject: [PATCH] soda_clix dockerfile --- .dockerignore | 18 ++++++++++++++++++ Dockerfile | 16 ++++++++++++++++ soda_cli_docker/.dockerignore | 12 ------------ soda_cli_docker/Dockerfile | 13 ------------- 4 files changed, 34 insertions(+), 25 deletions(-) create mode 100644 .dockerignore create mode 100644 Dockerfile delete mode 100644 soda_cli_docker/.dockerignore delete mode 100644 soda_cli_docker/Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..88b060a --- /dev/null +++ b/.dockerignore @@ -0,0 +1,18 @@ +.design +.github +.idea +.images +.logo +.soda_resource_tools_server +.soda_resource_tools_webui +soda_cli/target +soda_cli/cache +soda_resource_tools_lib/target +soda_resource_tools_lib/cache +.vscode +soda_cli_config +target +Cargo.lock +Cross.toml +soda_clix_build_release.ps1 +soda_clix_build_release.sh \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..b428936 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,16 @@ +# 阶段1: 构建阶段 +FROM rust:latest as builder +RUN apt-get update && \ + apt-get install -y openssl libssl-dev pkg-config && \ + rm -rf /var/lib/apt/lists/* +WORKDIR /usr/src/soda +COPY . . +RUN cargo build --release + +# 阶段2: 最终镜像 +FROM ubuntu:latest +ARG DEBIAN_FRONTEND=noninteractive +COPY --from=builder /usr/src/soda/target/release/soda_clix /usr/local/bin/soda_clix +RUN chmod +rx /usr/local/bin/soda_clix && ls -l /usr/local/bin/soda_clix +# CMD [ "/usr/local/bin/soda_clix --version" ] +CMD tail -f /dev/null \ No newline at end of file diff --git a/soda_cli_docker/.dockerignore b/soda_cli_docker/.dockerignore deleted file mode 100644 index fb91ffd..0000000 --- a/soda_cli_docker/.dockerignore +++ /dev/null @@ -1,12 +0,0 @@ -# Ignore git -.github -.git -.idea -.images -.logo -.soda_resource_tools_server -.soda_resource_tools_webui -.vscode -soda_cli -soda_cli_config -soda_resource_tools_lib \ No newline at end of file diff --git a/soda_cli_docker/Dockerfile b/soda_cli_docker/Dockerfile deleted file mode 100644 index 4d6bff4..0000000 --- a/soda_cli_docker/Dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -# 使用官方Rust镜像作为基础镜像 -FROM rust:latest - -# 安装OpenSSL -RUN apt-get update && \ - apt-get install -y openssl libssl-dev pkg-config && \ - rm -rf /var/lib/apt/lists/* - -# install soda_clix -RUN cargo install soda_clix - -# test soda_clix -RUN soda_clix --version \ No newline at end of file