From 9a2bf497a42c99f8472866f35642553ce78746da Mon Sep 17 00:00:00 2001 From: Chad Baxter Date: Mon, 22 Jan 2024 00:31:08 -0500 Subject: [PATCH 1/4] silly containers --- Containerfile | 24 ++++++++++++++++++++++++ container-compose.yml | 11 +++++++++++ 2 files changed, 35 insertions(+) create mode 100644 Containerfile create mode 100644 container-compose.yml diff --git a/Containerfile b/Containerfile new file mode 100644 index 0000000..5be4317 --- /dev/null +++ b/Containerfile @@ -0,0 +1,24 @@ +FROM lukemathwalker/cargo-chef:latest-rust-alpine as chef +WORKDIR /app + +FROM chef AS planner +COPY ./Cargo.toml ./Cargo.lock ./ +COPY ./src ./src +RUN apk add sed +RUN sed -i 's/\[::\]/0.0.0.0/g' /app/src/web/mod.rs +RUN cargo chef prepare + +FROM chef AS builder +COPY --from=planner /app/recipe.json . +RUN cargo chef cook --release +COPY . . +RUN apk add sed +RUN sed -i 's/\[::\]/0.0.0.0/g' /app/src/web/mod.rs +RUN cargo build --release +RUN mv ./target/release/metasearch2 ./app + +FROM scratch AS runtime +WORKDIR /app +COPY --from=builder /app/app /usr/local/bin/ +EXPOSE 28019 +ENTRYPOINT ["/usr/local/bin/app"] diff --git a/container-compose.yml b/container-compose.yml new file mode 100644 index 0000000..c2604ff --- /dev/null +++ b/container-compose.yml @@ -0,0 +1,11 @@ +version: '3.7' + +services: + honeyup: + container_name: metasearch2 + build: + context: . + dockerfile: Containerfile + ports: + - '28019:28019' + restart: unless-stopped From 82ca983564344a585145f8b03bf28f284c840e0f Mon Sep 17 00:00:00 2001 From: Chad Baxter Date: Mon, 22 Jan 2024 17:18:54 -0500 Subject: [PATCH 2/4] fixed refactor error --- container-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/container-compose.yml b/container-compose.yml index c2604ff..e478c8f 100644 --- a/container-compose.yml +++ b/container-compose.yml @@ -1,7 +1,7 @@ version: '3.7' services: - honeyup: + metasearch2: container_name: metasearch2 build: context: . From 2bbbc2909e597fc7f334306805279362c5330c53 Mon Sep 17 00:00:00 2001 From: Chad Baxter Date: Mon, 22 Jan 2024 22:01:21 -0500 Subject: [PATCH 3/4] use host networking --- container-compose.yml => compose.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) rename container-compose.yml => compose.yml (66%) diff --git a/container-compose.yml b/compose.yml similarity index 66% rename from container-compose.yml rename to compose.yml index e478c8f..5832886 100644 --- a/container-compose.yml +++ b/compose.yml @@ -2,10 +2,8 @@ version: '3.7' services: metasearch2: - container_name: metasearch2 build: context: . dockerfile: Containerfile - ports: - - '28019:28019' + network_mode: "host" restart: unless-stopped From 5c46679dd6029bbe40892a9d80a9fbdb435a23f6 Mon Sep 17 00:00:00 2001 From: mat Date: Fri, 2 Feb 2024 21:49:09 -0600 Subject: [PATCH 4/4] remove replace bind addr with 0.0.0.0 the default addr was switched to 0.0.0.0 in the main branch now anyways --- Containerfile | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Containerfile b/Containerfile index 5be4317..c6e74a3 100644 --- a/Containerfile +++ b/Containerfile @@ -4,16 +4,12 @@ WORKDIR /app FROM chef AS planner COPY ./Cargo.toml ./Cargo.lock ./ COPY ./src ./src -RUN apk add sed -RUN sed -i 's/\[::\]/0.0.0.0/g' /app/src/web/mod.rs RUN cargo chef prepare FROM chef AS builder COPY --from=planner /app/recipe.json . RUN cargo chef cook --release COPY . . -RUN apk add sed -RUN sed -i 's/\[::\]/0.0.0.0/g' /app/src/web/mod.rs RUN cargo build --release RUN mv ./target/release/metasearch2 ./app