From 997ca18eb8df301932c2672f3d776109719744ff Mon Sep 17 00:00:00 2001 From: jazkamer Date: Thu, 2 Apr 2026 15:40:40 +0300 Subject: [PATCH 1/2] feat: Add Dockerfile --- Dockerfile | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..bb4749d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,45 @@ +# ======================== +# Build Stage +# ======================== +FROM rust:1.89.0-alpine3.20 AS builder + +# Install build dependencies, including static OpenSSL libraries +RUN apk add --no-cache \ + pkgconfig \ + build-base \ + curl + +# Set the working directory +WORKDIR /usr/src/app + +# Copy over Cargo.toml and Cargo.lock for dependency caching +COPY Cargo.toml Cargo.lock ./ + +# Copy over all the source code +COPY . . + +# Build the project in release mode for the MUSL target +RUN cargo build --release --bin homegate + +# Strip the binary to reduce size +RUN strip target/release/homegate + +# ======================== +# Runtime Stage +# ======================== +FROM alpine:3.20 + +# Install runtime dependencies (only ca-certificates) +RUN apk add --no-cache ca-certificates + +# Copy the compiled binary from the builder stage +COPY --from=builder /usr/src/app/target/release/homegate /usr/local/bin/homegate + +# Set the working directory +WORKDIR /usr/local/bin + +# Expose the port the homegate listens on (should match that of config.toml) +EXPOSE 8080 + +# Set the default command to run the binary +CMD ["homegate"] From 2f9f581adec1e8410639e339941bf5c3990376f6 Mon Sep 17 00:00:00 2001 From: jazkamer Date: Mon, 6 Apr 2026 12:12:10 +0300 Subject: [PATCH 2/2] feat: remove strip from Dockerfile --- Dockerfile | 3 --- 1 file changed, 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index bb4749d..7c933c8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,9 +21,6 @@ COPY . . # Build the project in release mode for the MUSL target RUN cargo build --release --bin homegate -# Strip the binary to reduce size -RUN strip target/release/homegate - # ======================== # Runtime Stage # ========================